线程池的源代码

时间:2016-10-29 05:12:50
【文件属性】:
文件名称:线程池的源代码
文件大小:3KB
文件格式:C
更新时间:2016-10-29 05:12:50
线程 //执行任务的链表节点信息 typedef struct tpool_work{ void * (*routine) (void *arg); //回调函数,任务运行时会回调此函数 void *arg; //回调函数的参数 struct tpool_work *next; //结点指针域 }tpool_work_st; //线程池链表属性 typedef struct threadpool{ int shutdown; /*线程池销毁标记*/ int max_thr_num; /*最大线程数*/ pthread_t *thr_id; //线程id数组 tpool_work_st *queue_head; //线程池队列头 pthread_mutex_t queue_lock; //线程池锁 pthread_cond_t queue_cond; //线程池条件变量 int cur_queue_size; /*当前排队任务数*/ }tpool_info_st;

网友评论