简体   繁体   English

C ++中的简单线程池

[英]Simple thread pool in C++

Could anyone point me to a sample implementation of a thread pool in C++, please? 有人能指点我在C ++中使用线程池的示例实现吗? 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++. 我认为如果你想在C ++中进行线程化,那将值得学习。

Boost also has some threading facilities. Boost还有一些线程设施。

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

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

in his book Modern C++ Programming with Test-Driven Development, Jeff Langr walks thru a threadpool implementation. 在他的书“使用测试驱动开发的现代C ++编程”中,Jeff Langr通过线程池实现。 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. 我在这里进一步修改了https://github.com/spakai/threadpool_future以支持信号等待和期货等事情。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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