From c479ef57baaaa28964fc3ec8d80ff99dffa7d49f Mon Sep 17 00:00:00 2001 From: fujuntang <fujuntang@smartai.com> Date: 星期三, 10 十一月 2021 09:49:29 +0800 Subject: [PATCH] Fix the system hang issue when the app is killed contantly. --- src/socket/bus_server_socket.h | 50 +++++++++++++++++++++++++++++++++++++++++++++++--- 1 files changed, 47 insertions(+), 3 deletions(-) diff --git a/src/socket/bus_server_socket.h b/src/socket/bus_server_socket.h index e60c700..4cd0140 100644 --- a/src/socket/bus_server_socket.h +++ b/src/socket/bus_server_socket.h @@ -8,6 +8,7 @@ #include "sem_util.h" #include "logger_factory.h" #include "key_def.h" +#include "msg_mgr.h" #include "socket_def.h" #include <set> @@ -18,12 +19,51 @@ typedef std::set<int, std::less<int>, SHM_STL_Allocator<int> > SHMKeySet; typedef std::map<SHMString, SHMKeySet *, std::less<SHMString>, SHM_STL_Allocator<std::pair<const SHMString, SHMKeySet *> > > SHMTopicSubMap; +typedef struct _LinkNode +{ + int data; + int data_fix; + int count; + + _LinkNode *next; +} LinkNode; + +class list +{ + +private: + + LinkNode *head; + +public: + + list() {head = NULL;}; + + void Insert(int aDate, int bDate); + + void Delete(int Data); + + int dataFixGet(int data); + + int dataGet(int data); + + void dataSet(int data, int val); + + int NodeNum(void); + + int nodeGet(int index); + + LinkNode *getHead() {return head;}; + +}; + class BusServerSocket { private: shm_socket_t *shm_socket; // pthread_t recv_thread; // <涓婚锛� 璁㈤槄鑰�> SHMTopicSubMap *topic_sub_map; + recvbuf_data recvBuf_data; private: int destroy(); @@ -66,6 +106,7 @@ * @return 0 鎴愬姛锛� 鍏朵粬鍊� 澶辫触鐨勯敊璇爜 */ int start(); + int get_data(int val); /** * 鍋滄bus @@ -73,15 +114,18 @@ * @return 0 鎴愬姛锛� 鍏朵粬鍊� 澶辫触鐨勯敊璇爜 */ int stop(); - - + int check_proc(int val, const void *buf, int len, void **buf_ret, int *len_ret, \ + const struct timespec *timeout, const int flag); + void remove_proc(int val); /** * 鑾峰彇soket key */ int get_key() ; - void _data_remove(int val1, int val2); + void _data_remove(int val); + void buf_data_set(int data, int val); + void buf_data_remove(int data); }; -- Gitblit v1.8.0