修复日志处理,优化磁盘io,优化退出流程

This commit is contained in:
2026-01-29 12:10:36 +08:00
parent 65115e1a74
commit ee596a654d
10 changed files with 183 additions and 51 deletions

View File

@ -241,9 +241,7 @@ int teml(Ctl *self,int fifo[2])
char input[TEM_MAX_BUF] = {'\0'};
ctx *command = (ctx*)malloc(sizeof(ctx));
Cmd cmd_dir[10];
init_interpreter(cmd_dir,command,fifo,self->logmanager);//初始化解释器
//创建线程用于定期清理日志
pthread_create(&self->logwathcher,NULL,self->logmanager->clear_log,self->logmanager);
init_interpreter(cmd_dir,command,fifo,self->logmanager);
command->statue = 0;
self->command = command;
do
@ -262,12 +260,6 @@ int teml(Ctl *self,int fifo[2])
const char fexp[256] = {'\0'};
memcpy(&input,&fexp,TEM_MAX_BUF);
}while(command->statue == 0);
log_manager_stop(self->logmanager);
pthread_join(self->logwathcher,NULL);
//关闭log定期清理程序
close(fifo[0]);
close(fifo[1]);
free_history(self);
self->command = NULL;
free(command);

View File

@ -15,7 +15,6 @@ typedef struct Ctl
int (*infifo)(struct Ctl*,const char*);
int index;
char *history[TEM_HISTORY_BUF];
pthread_t logwathcher;
log_manager *logmanager;
ctx *command;//解释器上下文
toml_table_t *config;