优化退出流程,统一注册到on_exit(

This commit is contained in:
2025-09-29 16:07:11 +08:00
parent afe70e6d17
commit 8c52e4ba84
9 changed files with 163 additions and 41 deletions

View File

@ -2,6 +2,7 @@
#define LOG
#include <semaphore.h>
#include <pthread.h>
#define MAX_LOG 256
@ -16,12 +17,17 @@ typedef struct log_manager
int (*in_log)(logs *,struct log_manager*);
logs* (*out_log)(struct log_manager*);
void *(*clear_log)(void*);
int (*cleanup)(struct log_manager*);
sem_t log_sem;
logs *log;
logs *rear;
int count;
pthread_mutex_t mtx;
pthread_cond_t cond;
int stop;
}log_manager;
void log_manager_stop(log_manager *self);
int init_loger(log_manager *self);
#endif