diff --git a/common/utils/LOG/log.c b/common/utils/LOG/log.c index f936ed5ae2..7b2dd406e0 100644 --- a/common/utils/LOG/log.c +++ b/common/utils/LOG/log.c @@ -45,6 +45,7 @@ #include "common/config/config_userapi.h" #include #include +#include #include "common/utils/LOG/log_extern.h" // main log variables @@ -810,7 +811,7 @@ void logClean (void) } } -extern int oai_exit; +static atomic_bool stop_flush_mem_to_file = false; void flush_mem_to_file(void) { int fp; @@ -821,7 +822,7 @@ void flush_mem_to_file(void) pthread_setname_np( pthread_self(), "flush_mem_to_file"); - while (!oai_exit) { + while (!atomic_load(&stop_flush_mem_to_file)) { pthread_mutex_lock(&log_mem_lock); log_mem_write_flag=0; pthread_cond_wait(&log_mem_notify, &log_mem_lock); @@ -981,6 +982,7 @@ void close_log_mem(void){ char f_name[1024]; if(log_mem_flag==1){ + atomic_store(&stop_flush_mem_to_file, false); log_mem_d[0].enable_flag=0; log_mem_d[1].enable_flag=0; usleep(10); // wait for log writing