Mod aaa-12 The method of thread exit was modified

RCA:
SOL:
修改人:zhangtao
检视人:zhangtao
This commit is contained in:
zhangtaohz 2019-06-26 17:08:59 +08:00
parent bb0011b4d5
commit dcb36ba8fd
2 changed files with 9 additions and 5 deletions

View File

@ -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();
if (async != 3) {
sleep(10);
}
trace_client_exit();
return 0;
}

View File

@ -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;
}