ThreadPool/Readme.md

424 B

ThreadPool

使用现代C++写的线程池.

class ThreadPool 线程池类

不可复制,不可移动

构造时需指定最大线程数,构造后不可更改

析构时等待所有线程工作结束.

API参考:

int start(const std::function<void()>&) 发送一个任务到线程池

返回值:

-1 无法启动任务,线程池已满

-2 线程池内部错误

>=0 任务启动成功,返回工作线程序号.