Chinaunix首页 | 论坛 | 博客
  • 博客访问: 538558
  • 博文数量: 102
  • 博客积分: 3165
  • 博客等级: 中校
  • 技术积分: 1232
  • 用 户 组: 普通用户
  • 注册时间: 2009-05-09 16:38
文章存档

2016年(1)

2013年(14)

2012年(6)

2011年(22)

2010年(57)

2009年(2)

我的朋友

分类: LINUX

2010-05-26 17:32:26

1 #include
  2 #include
  3 typedef struct work{
  4     void* (*thread)(void*);
  5     void * arg;
  6     struct work *next;
  7 }threadpool_work;
  8
  9 typedef struct threadpool{
10     threadpool_work* head;
11     pthread_t* pid;
12     int current_size;
13     int max_thread_size;
14     pthread_mutex_t list_lock;
15     pthread_cond_t work_avilable;
16     int shutdown;
17 }*threadpool_t;
18
19 void threadpool_init(threadpool_t* tpool,int max_thread_size);
20 void threadpool_add_work(threadpool_t* tpool,void* (*pthread)(void *),void* arg);
21 void* threadpool_get_work(threadpool_t* tpool);
22 void threadpool_destroy(threadpool_t* tpool);
阅读(784) | 评论(0) | 转发(1) |
给主人留下些什么吧!~~