Simple thread pool in C++

2019-02-19 01:38发布

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.

4条回答
兄弟一词,经得起流年.
2楼-- · 2019-02-19 02:14

This is a very good one : threadpool its built uppon boost so its cross platform and everything , very easy to use as well

查看更多
干净又极端
3楼-- · 2019-02-19 02:18

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.

查看更多
不美不萌又怎样
4楼-- · 2019-02-19 02:20

It may be worth to check out Qt's QThreadPool implementation.

查看更多
劳资没心,怎么记你
5楼-- · 2019-02-19 02:26

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.

查看更多
登录 后发表回答