简体   繁体   中英

Simple thread pool in C++

Could anyone point me to a sample implementation of a thread pool in C++, please? I'm looking for a very basic one without too much complexity, which would be suitable for a beginner in threading to study.

Look at Intel's Thread Building Blocks . I don't know how well that library meets your "simple" criteria, but it seems to be very well thought-out and thorough. I would think that it would be worth the effort to learn if you want to do threading in C++.

Boost also has some threading facilities.

可能值得查看Qt的QThreadPool实现。

这是一个非常好的: threadpool它的内置uppon boost所以它的跨平台和一切,也很容易使用

in his book Modern C++ Programming with Test-Driven Development, Jeff Langr walks thru a threadpool implementation. It's a busy wait implementation. I've modified it further here https://github.com/spakai/threadpool_future to support things such as signal-wait and futures.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM