# ThreadPool **Repository Path**: js2854/threadpool ## Basic Information - **Project Name**: ThreadPool - **Description**: 利用 pthread 实现的简单高效的线程池。 - **Primary Language**: C++ - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 3 - **Forks**: 13 - **Created**: 2013-09-06 - **Last Updated**: 2020-12-19 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README 简介 == 简单的线程池,接受工作函数的形式如下(与 pthread 相同) `void work_function(void arg);` 在构造时用固定的线程数一次性初始化(之后不允许更改),在 run() 后开始运行。 分派工作采用 dispatch() 方法,同步当前所有任务采用 sync() 方法。 线程池析构时将释放所有资源,并关闭所有的相关线程。 使用方法 ==== 需要 pthread 库(或者 pthread-win32)的路径和链接库正确配置,将头文件和源文件添加到项目中即可。 可参考 test.cpp 文件中的用法,其中还比较了本线程池和 OpenMP 直接加速的运行时间。