简体   繁体   English

不使用boost lib的C ++线程池

[英]C++ Threadpool without using boost lib

I have to use a threadpool in my program but I have no idea how to use it. 我必须在程序中使用线程池,但不知道如何使用它。 I know how to create and use a thread but after a lot of research, I can't find how can I implement a threadpool without using boost lib (forbidden). 我知道如何创建和使用线程,但是经过大量研究,我发现如果不使用boost lib(禁止)就无法实现线程池。 If you have some ideas or searching path, I will appreciate it. 如果您有任何想法或搜索路径,我将不胜感激。 I'm not asking for a full code but at least if you can lead me. 我不是要完整的代码,但至少可以请我帮忙。

I've just googled 20 seconds and I've found this, hope it helps, since your question is how to use threadpool 我刚刚用Google搜索了20秒,发现了这一点,希望对您有所帮助,因为您的问题是如何使用线程池

C++ Thread Pool C ++线程池

EDIT: 编辑:

Without boost: Simple thread pool in C++ 没有提升: C ++中的简单线程池

However this thread has "HOMEWORK" written all over it. 但是,此线程的所有位置都写有“ HOMEWORK”。 Good luck ;) 祝好运 ;)

Here is a production ready thread pool I had written long ago in C++. 这是我很早以前用C ++编写的可用于生产环境的线程池。 C++ Plugin Thread Pool using the Command Pattern and Chain of Responsibility pattern. 使用命令模式和责任链模式的C ++插件线程池 Has quite a bit of advanced C++ like functors etc which may feel bit difficult to read. 具有相当多的高级C ++(例如函子等),可能难以阅读。

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

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