<small id='b00pR'></small><noframes id='b00pR'>

        • <bdo id='b00pR'></bdo><ul id='b00pR'></ul>
        <tfoot id='b00pR'></tfoot>
        <i id='b00pR'><tr id='b00pR'><dt id='b00pR'><q id='b00pR'><span id='b00pR'><b id='b00pR'><form id='b00pR'><ins id='b00pR'></ins><ul id='b00pR'></ul><sub id='b00pR'></sub></form><legend id='b00pR'></legend><bdo id='b00pR'><pre id='b00pR'><center id='b00pR'></center></pre></bdo></b><th id='b00pR'></th></span></q></dt></tr></i><div id='b00pR'><tfoot id='b00pR'></tfoot><dl id='b00pR'><fieldset id='b00pR'></fieldset></dl></div>
        <legend id='b00pR'><style id='b00pR'><dir id='b00pR'><q id='b00pR'></q></dir></style></legend>

        C++ 线程池

        C++ Thread Pool(C++ 线程池)

        <small id='JWcl6'></small><noframes id='JWcl6'>

            <tbody id='JWcl6'></tbody>
          <tfoot id='JWcl6'></tfoot>
            <i id='JWcl6'><tr id='JWcl6'><dt id='JWcl6'><q id='JWcl6'><span id='JWcl6'><b id='JWcl6'><form id='JWcl6'><ins id='JWcl6'></ins><ul id='JWcl6'></ul><sub id='JWcl6'></sub></form><legend id='JWcl6'></legend><bdo id='JWcl6'><pre id='JWcl6'><center id='JWcl6'></center></pre></bdo></b><th id='JWcl6'></th></span></q></dt></tr></i><div id='JWcl6'><tfoot id='JWcl6'></tfoot><dl id='JWcl6'><fieldset id='JWcl6'></fieldset></dl></div>

                <bdo id='JWcl6'></bdo><ul id='JWcl6'></ul>
                1. <legend id='JWcl6'><style id='JWcl6'><dir id='JWcl6'><q id='JWcl6'></q></dir></style></legend>
                2. 本文介绍了C++ 线程池的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  在生产代码中使用 C++ 的线程池的好的开源实现是什么(类似于 boost)?

                  What is a good open source implementation of a thread pool for C++ to use in production code (something like boost)?

                  请提供您自己的示例代码或示例代码用法的链接.

                  Please provide either your own example code or a link to example code usage.

                  推荐答案

                  我认为它仍然不被 Boost 接受,但是一个很好的起点:线程池.一些用法示例,来自网站:

                  I think it is still not accepted into Boost, but a good staring point: threadpool. Some example of usage, from the web site:

                  #include "threadpool.hpp"
                  
                  using namespace boost::threadpool;
                  
                  // Some example tasks
                  void first_task()
                  {
                    ...
                  }
                  
                  void second_task()
                  {
                    ...
                  }
                  
                  void third_task()
                  {
                    ...
                  }
                  
                  void execute_with_threadpool()
                  {
                    // Create a thread pool.
                    pool tp(2);
                  
                    // Add some tasks to the pool.
                    tp.schedule(&first_task);
                    tp.schedule(&second_task);
                    tp.schedule(&third_task);
                  
                    // Leave this function and wait until all tasks are finished.
                  }
                  

                  池的参数2"表示线程数.在这种情况下,tp 的销毁等待所有线程完成.

                  The argument "2" to the pool indicates the number of threads. In this case, the destruction of tp waits for all threads to finish.

                  这篇关于C++ 线程池的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                  相关文档推荐

                  How to limit the number of running instances in C++(C++中如何限制运行实例的数量)
                  Using boost::asio::async_read with stdin?(将 boost::asio::async_read 与 stdin 一起使用?)
                  How to find out what dependencies (i.e other Boost libraries) a particular Boost library requires?(如何找出特定 Boost 库需要哪些依赖项(即其他 Boost 库)?)
                  What#39;s the purpose of a leading quot;::quot; in a C++ method call(引导“::的目的是什么?在 C++ 方法调用中)
                  Boost Spirit x3: parse into structs(Boost Spirit x3:解析为结构体)
                  How boost auto-linking makes choice?(boost自动链接如何做出选择?)

                    1. <small id='tDPO3'></small><noframes id='tDPO3'>

                        <i id='tDPO3'><tr id='tDPO3'><dt id='tDPO3'><q id='tDPO3'><span id='tDPO3'><b id='tDPO3'><form id='tDPO3'><ins id='tDPO3'></ins><ul id='tDPO3'></ul><sub id='tDPO3'></sub></form><legend id='tDPO3'></legend><bdo id='tDPO3'><pre id='tDPO3'><center id='tDPO3'></center></pre></bdo></b><th id='tDPO3'></th></span></q></dt></tr></i><div id='tDPO3'><tfoot id='tDPO3'></tfoot><dl id='tDPO3'><fieldset id='tDPO3'></fieldset></dl></div>
                        <legend id='tDPO3'><style id='tDPO3'><dir id='tDPO3'><q id='tDPO3'></q></dir></style></legend>
                          <tbody id='tDPO3'></tbody>
                          <bdo id='tDPO3'></bdo><ul id='tDPO3'></ul>
                          <tfoot id='tDPO3'></tfoot>