https://github.com/yuesong-feng/threadpoll
C++线程池
https://github.com/yuesong-feng/threadpoll
Last synced: 2 months ago
JSON representation
C++线程池
- Host: GitHub
- URL: https://github.com/yuesong-feng/threadpoll
- Owner: yuesong-feng
- Created: 2021-07-16T08:06:09.000Z (almost 4 years ago)
- Default Branch: master
- Last Pushed: 2021-08-25T11:34:21.000Z (over 3 years ago)
- Last Synced: 2024-12-24T12:10:32.366Z (4 months ago)
- Language: C++
- Homepage:
- Size: 8.79 KB
- Stars: 2
- Watchers: 2
- Forks: 3
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# ThreadPoll
C++线程池
## api
```c++
#include "ThreadPoll.h"ThreadPoll poll(int size); //创建一个线程池,传入size表示工作线程数量
/*
int myfunction(int i, char c, std::string str){
......
}
*/
std::function func = my_function; //func可以理解为C中的函数指针,指向my_function函数,可以通过func调用/*
add函数定义,支持任意返回类型、任意参数类型、任意参数个数
template
void add(std::function, Args...);
*/
poll.add(func, 1, 'a', std::string("Hello World!")); //将func指向的函数添加到线程池,函数参数按顺序传递```