From d69e2a2ed12d639cca99a4718250aacd6579987c Mon Sep 17 00:00:00 2001
From: fujuntang <fujuntang@smartai.com>
Date: 星期日, 10 十月 2021 13:33:50 +0800
Subject: [PATCH] Add the deadlock detect feature.

---
 src/bh_api.cpp |   13 +++++++++++--
 1 files changed, 11 insertions(+), 2 deletions(-)

diff --git a/src/bh_api.cpp b/src/bh_api.cpp
index b774d4e..8b03231 100644
--- a/src/bh_api.cpp
+++ b/src/bh_api.cpp
@@ -7,6 +7,7 @@
 #include "bh_api.h"
 #include <pthread.h>
 #include <getopt.h>
+#include "msg_mgr.h"
 #include "../proto/source/error_msg.pb.h"
 #include "../proto/source/bhome_msg.pb.h"
 #include "../proto/source/bhome_msg_api.pb.h"
@@ -102,6 +103,10 @@
   memset(&pData, 0x00, sizeof(ProcInfo));
   if (gRun_stat == 0) {
     pthread_mutex_init(&mutex, NULL);
+    
+#if defined(MSG_HANDLER)
+    msg_init();
+#endif 
 
   } else {
     logger->error("the process has already registered!\n");
@@ -1814,9 +1819,13 @@
 
 }
 
+#if defined(MSG_HANDLER)
 int inter_key_get(void)
 {
-  return net_mod_socket_get_key(gNetmod_socket);  
-}
+  if (gNetmod_socket != NULL)
+    return net_mod_socket_get_key(gNetmod_socket);
 
+  return 0;
+}
+#endif 
 

--
Gitblit v1.8.0