linuxC语言线程池实现CP命令

时间:2020-01-24 06:04:30
【文件属性】:
文件名称:linuxC语言线程池实现CP命令
文件大小:1.83MB
文件格式:ZIP
更新时间:2020-01-24 06:04:30
linux C 多线程 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);
【文件预览】:
linux C语言 线程池实现CP命令
----copy_simulation.zip(8KB)
----linux高级编程期末设计报告.pptx(1.88MB)

网友评论