📄 thread.c
字号:
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <pthread.h>
#include <signal.h>
#include <mysql.h>
#include "devicelog.h"
#include "queue.h"
#include "server.h"
#include "db.h"
#include "logging.h"
#include "thread.h"
LinkQueue *Q=NULL;
extern MYSQL* conn;
void exit_service()
{
if(conn != NULL)
disconnect(conn);
DestroyQueue(Q);
log_info("ITWORKS","The system have exited!");
uninit_logging();
exit(0);
}
int main(int argc,char *argv[])
{
// init_daemon();
printf("Hello!\n");
init_logging();
log_info("ITWORKS","The system started!");
Q=(LinkQueue*)malloc(sizeof(LinkQueue));
if(NULL==Q)
{
log_fatal("Queue","The Queue can not be malloced !\n");
return 1;
}
InitQueue(Q);
signal(SIGTERM,(void *)exit_service);
signal(SIGINT, (void *)exit_service);
start_db_service();
startserver();
return 0;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -