From dcb36ba8fd76b18dccf8eafced6fe857fb057255 Mon Sep 17 00:00:00 2001 From: zhangtaohz Date: Wed, 26 Jun 2019 17:08:59 +0800 Subject: [PATCH] =?UTF-8?q?Mod=20aaa-12=20The=20method=20of=20thread=20exi?= =?UTF-8?q?t=20=20was=20modified=20RCA=EF=BC=9A=20SOL=EF=BC=9A=20=E4=BF=AE?= =?UTF-8?q?=E6=94=B9=E4=BA=BA=EF=BC=9Azhangtao=20=E6=A3=80=E8=A7=86?= =?UTF-8?q?=E4=BA=BA=EF=BC=9Azhangtao?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Platform/user/trace/test/test_client_main.c | 7 +++++-- Platform/user/trace/trace-api/trace_api.c | 7 ++++--- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/Platform/user/trace/test/test_client_main.c b/Platform/user/trace/test/test_client_main.c index a46b28b22..d7d03a23b 100755 --- a/Platform/user/trace/test/test_client_main.c +++ b/Platform/user/trace/test/test_client_main.c @@ -53,13 +53,16 @@ int main(int argc, char **argv) } else { printf("sync exec\n"); trace_sync_exec(&trace1); + printf("sync final\n"); } printf("send success\n"); } //policy_client_exit(); - sleep(10); - + if (async != 3) { + sleep(10); + } + trace_client_exit(); return 0; } diff --git a/Platform/user/trace/trace-api/trace_api.c b/Platform/user/trace/trace-api/trace_api.c index d3bd222e9..32a24e97d 100755 --- a/Platform/user/trace/trace-api/trace_api.c +++ b/Platform/user/trace/trace-api/trace_api.c @@ -59,7 +59,7 @@ typedef struct _sess { static int g_pid; static pthread_t g_client_thread; -static volatile int g_client_stop = 0; +//static volatile int g_client_stop = 0; static uint32_t g_seq = 0; static volatile sess_t g_sess = {0}; @@ -256,7 +256,8 @@ FAIL: trace_ret_t trace_client_exit() { - g_client_stop = 1; + //g_client_stop = 1; + cfg_channel_close(); // 先关闭,判断SOCKET异常来退出线程 pthread_join(g_client_thread, NULL); for (int i = 0; i < sizeof(g_sess.hsess_mutex) / sizeof(pthread_mutex_t); i++) { @@ -267,7 +268,7 @@ trace_ret_t trace_client_exit() struct hlist_node *n; COLLECT_HLIST_CLEAR(pos, n, g_sess.hess, sizeof(g_sess.hess) / sizeof(struct hlist_head), node, free); - cfg_channel_close(); + return TRACE_SUCCESS; }