log管理器内存分配池化,修复部分log写入部分与内存池部分存在的恶性bug

This commit is contained in:
2026-02-21 15:04:04 +08:00
parent b618cc359a
commit d81a3c8042
16 changed files with 189 additions and 277 deletions

View File

@ -2,6 +2,7 @@
#define LOG
#include "config.h"
#include "memctl/memctl.h"
#include <semaphore.h>
#include <pthread.h>
@ -9,27 +10,27 @@
typedef struct logs
{
char log[MAX_LOG_LENGTH];
struct logs *next;
void **next;
char info[INFO_LENGTH];
}logs;
typedef struct log_manager
{
pthread_t pid;
int (*in_log)(logs *,struct log_manager*);
logs* (*out_log)(struct log_manager*);
mem_ctl *mempool;
int (*in_log)(struct log_manager*,const char *,const char *);
void *(*clear_log)(void*);
int (*cleanup)(struct log_manager*);
sem_t log_sem;
logs *log;
void **log;
logs *rear;
int count;
atomic_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);
int init_loger(log_manager *self,mem_ctl *mempool);
#endif