修复日志缓存计数错误
This commit is contained in:
@ -146,6 +146,10 @@ void *pth_module(void *args_p)
|
|||||||
NULL};
|
NULL};
|
||||||
execv("Run_pluhginmanager",args);
|
execv("Run_pluhginmanager",args);
|
||||||
}
|
}
|
||||||
|
logs *pth_log = (logs*)malloc(sizeof(logs));
|
||||||
|
sprintf(pth_log->log,"PID:%lu launched python plugines\n",pmd->pthread_id);
|
||||||
|
|
||||||
|
logger->in_log(pth_log,logger);
|
||||||
//拉起python插件管理器
|
//拉起python插件管理器
|
||||||
for(;;){
|
for(;;){
|
||||||
//线程池中,单个线程模型
|
//线程池中,单个线程模型
|
||||||
|
@ -14,6 +14,7 @@ int in_log(logs *log,log_manager *self)
|
|||||||
if(self->log == NULL){
|
if(self->log == NULL){
|
||||||
self->log = log;
|
self->log = log;
|
||||||
self->rear = log;
|
self->rear = log;
|
||||||
|
self->count++;
|
||||||
sem_post(&self->log_sem);
|
sem_post(&self->log_sem);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -83,6 +84,7 @@ int cleanup(log_manager *self)
|
|||||||
sem_wait(&self->log_sem);
|
sem_wait(&self->log_sem);
|
||||||
loc = self->log;
|
loc = self->log;
|
||||||
self->log = NULL;
|
self->log = NULL;
|
||||||
|
self->count = 0;
|
||||||
sem_post(&self->log_sem);
|
sem_post(&self->log_sem);
|
||||||
while(loc->next !=NULL)
|
while(loc->next !=NULL)
|
||||||
{
|
{
|
||||||
@ -139,4 +141,5 @@ int init_loger(log_manager *self)
|
|||||||
self->log = NULL;
|
self->log = NULL;
|
||||||
self->stop = 0;
|
self->stop = 0;
|
||||||
self->cleanup = cleanup;
|
self->cleanup = cleanup;
|
||||||
|
self->count = 0;
|
||||||
}
|
}
|
Reference in New Issue
Block a user