linuxC语言线程池实现CP命令
linux系统下C语言 利用线程池技术实现CP命令 压缩包包含:源代码+开发说明PPT 线程池头文件: //任务 struct task { void *(*task)(void *arg); void *arg; struct task *next; }; //线程池 typedef struct thread_pool { pthread_mutex_t lock;//互斥锁 pthread_cond_t cond;//条件变量 struct task *task_list;//任务队列 pthread_t *tids;//线程id unsigned waiting_tasks;//等待任务 unsigned active_threads;// bool shutdown;//停始状态 }thread_pool; //初始化线程池 bool init_pool(thread_pool *pool, unsigned int threads_number); //新增任务 bool add_task(thread_pool *pool, void *(*task)(void *arg), void *arg); //新增线程 int add_thread(thread_pool *pool, unsigned int additional_threads_number); //移除线程 int remove_thread(thread_pool *pool, unsigned int removing_threads_number); //销毁线程池 bool destroy_pool(thread_pool *pool); //处理程序 void *routine(void *arg);
- 1
- 粉丝: 0
- 资源: 10
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助