diff options
| author | yangwei <[email protected]> | 2023-07-26 23:22:27 +0800 |
|---|---|---|
| committer | yangwei <[email protected]> | 2023-07-26 23:22:27 +0800 |
| commit | 1c9045b33f887500798bb768e4887399d9520e1c (patch) | |
| tree | 2d478e2dfd6ab3f65440bbdefb601355e50e7d0d | |
| parent | 96d6c90e4fb5fd2bb196b62c0b6707f8e4ee779b (diff) | |
🌈 style(packet_io exit): 调整进程退出时的输出格式,方便展示进度v4.3.19
| -rw-r--r-- | src/packet_io/packet_io_pcap.c | 5 | ||||
| -rw-r--r-- | src/sapp_dev/sapp_plug.c | 5 |
2 files changed, 7 insertions, 3 deletions
diff --git a/src/packet_io/packet_io_pcap.c b/src/packet_io/packet_io_pcap.c index b56fd2b..31a6154 100644 --- a/src/packet_io/packet_io_pcap.c +++ b/src/packet_io/packet_io_pcap.c @@ -1528,10 +1528,11 @@ static void *pcap_io_thread(void *arg) thread_exit:
*stop_flag = 1;
sapp_usleep(1000);
+ pthread_t tid = pthread_self();
sapp_set_current_state(SAPP_STATE_READY_TO_EXIT);
if(exit_prog_flag){
- printf("pcap_io_thread SAPP_STATE_READY_TO_EXIT, call exit() !\n");
- exit(0);
+ printf("pcap_io_thread %lu SAPP_STATE_READY_TO_EXIT, call pthread_exit()!\n",(unsigned long)tid);
+ pthread_exit(NULL);
}
return NULL;
diff --git a/src/sapp_dev/sapp_plug.c b/src/sapp_dev/sapp_plug.c index f6661fc..b8f7cd0 100644 --- a/src/sapp_dev/sapp_plug.c +++ b/src/sapp_dev/sapp_plug.c @@ -150,8 +150,10 @@ static void *sapp_monitor_thread(void *args) usleep(10000); } - sapp_runtime_log(RLOG_LV_FATAL, "sapp_monitor_thread begin libsapp_destroy_env!\n"); + sapp_runtime_log(RLOG_LV_FATAL, "sapp_monitor_thread, start libsapp_destroy_env!"); + printf("sapp_monitor_thread, start libsapp_destroy_env!\n"); libsapp_destroy_env(); + printf("sapp_monitor_thread, finish libsapp_destroy_env, call_exit!\n"); exit(0); return NULL; } @@ -266,6 +268,7 @@ void libsapp_destroy_env(void) �������ͬ������, ��double free��!! �˴������ü�������һ���Ⱥ���˳��. */ + printf("libsapp_destroy_env start, try to sync exit state!\n"); sapp_runtime_log(RLOG_LV_FATAL, "libsapp_destroy_env begin, try to sync exit state !"); if(MESA_ATOMIC_INC(g_sapp_destory_env_running_state) != 1){ /* ��ʼ��ʱ��0, INC����1, ˵����������һ���߳�������destroy����, �����ȴ�, ֱ������Ϊֹ */ |
