📄 testpool.c
字号:
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <pthread.h>
#include "public.h"
#include "tpool.h"
#include "common.h"
void dowork(void *arg)
{
char * ptr=(char *)arg;
sleep(1);
printf("hello world! %s\n",ptr);
/* sleep(1); */
/* lprintf(log,INFO,"hello world %s\n",ptr);*/
}
int main(int argc, char *argv[])
{
tpool_t *pool; /*define a thread pool*/
//daemonize();
logd=log_open("test.log", 0);
pool=tpool_init(100,200,1);
// tpool_add_work(pool,dowork,"test!");
sleep(10);
tpool_destroy(pool,1);
log_close(logd);
pthread_exit(NULL);
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -