探索如何通过小程序容器技术提升社交游戏的用户参与度与留存率
983
2022-10-14
Reuzel:小巧的 C++ 线程池库
Reuzel
Reuzel is a tiny C++ thread pool with these features:
Only runs on LinuxC++11 syntax and POSIX ThreadsSimple APIStarts all threads on creation of the thread poolStops and joins all threads on destroy
Build and example
The thread pool uses C++11 syntax and POSIX Threads so if you compile with g++ on Linux you have to use the flags '-lpthread', '-std=c++11' like this:
g++ -std=c++11 ThreadPool.cpp Thread.cpp example.cpp -lpthread -o example
Then run the executable like this:
./example
if you want to run the test example:
make./Reuzel
Building with Buck
Reuzel can also be built using Buck:
buck build :reuzel
To run the test example:
buck run test/
Basic Usage
Include the header file in your source file:#include "ThreadPool.h"Create a thread pool:ThreadPool thpool;Set max size of task queue, and create worker threads:setMaxQueueSize(), start();Add task to the pool:addTask();
Contribution
You are very welcome to contribute!
版权声明:本文内容由网络用户投稿,版权归原作者所有,本站不拥有其著作权,亦不承担相应法律责任。如果您发现本站中有涉嫌抄袭或描述失实的内容,请联系我们jiasou666@gmail.com 处理,核实后本网站将在24小时内删除侵权内容。
发表评论
暂时没有评论,来抢沙发吧~