From a6f67b4249525089fb97eb9418c7014f66c2a000 Mon Sep 17 00:00:00 2001 From: lichao <lichao@aiotlink.com> Date: 星期三, 28 四月 2021 19:29:17 +0800 Subject: [PATCH] use new robust mutex, circurar; rm timeout mutex. --- src/bh_api.cpp | 16 +++++++++++++--- 1 files changed, 13 insertions(+), 3 deletions(-) diff --git a/src/bh_api.cpp b/src/bh_api.cpp index c4ac9c9..c29afd9 100644 --- a/src/bh_api.cpp +++ b/src/bh_api.cpp @@ -8,11 +8,15 @@ namespace { +std::unique_ptr<TopicNode> &ProcNodePtr() +{ + static bool init = GlobalInit(BHomeShm()); + static std::unique_ptr<TopicNode> ptr(new TopicNode(BHomeShm())); + return ptr; +} TopicNode &ProcNode() { - static bool init_bind_msg_shm = MsgI::BindShm(BHomeShm()); - static TopicNode node(BHomeShm()); - return node; + return *ProcNodePtr(); } class TmpPtr : private boost::noncopyable @@ -320,6 +324,12 @@ free(data); } +int BHCleanup() +{ + ProcNodePtr().reset(); + return 0; +} + int BHGetLastError(void **msg, int *msg_len) { int ec = 0; -- Gitblit v1.8.0