
Hi Everyone, Has there been any development with regards to a working, portable Boost.Thread based Thread Pool library? Personally I've been using the following sample idiom for achieving what a thread pool is supposed to be accomplishing -- and I'm wondering (aloud) whether there are any existing implementations out there that rely solely on Boost.Thread. Currently, the following code snippet requires Boost.Asio, but I'm not sure if there's something that may be distilled from the recurring pattern below: { using namespace boost::asio; using namespace boost; io_service process_queue; shared_ptr<io_service::work> sentinel(new io_service::work(process_queue)); thread_group processor_threads; for(unsigned int spawn_counter = THREAD_COUNT; spawn_counter > 0; --spawn_counter) processor_threads.create_thread( bind(&io_service::work, &process_queue) ); // add all void nullary functors and post them here process_queue.post(function_object); // once all the work has been queued, remove the sentinel sentinel.reset(); processor_threads.join_all(); } Will something like this be useful as a utility library? Insights, pointers, and suggestions would be very much appreciated. Have a great day everyone! -- Dean Michael C. Berris Software Engineer, Friendster, Inc. [http://cplusplus-soup.blogspot.com/] [mikhailberis@gmail.com] [+63 928 7291459] [+1 408 4049523]

Hello Michael There is working implementation at http://threadpool.sourceforge.net/ - it already fixed to match new boost.thread. I had used it not so far for my tests, and it's works fine On 10/31/07, Dean Michael Berris <mikhailberis@gmail.com> wrote:
-- With best wishes, Alex Ott, MBA http://alexott.blogspot.com/ http://alexott-ru.blogspot.com/ http://content-filtering.blogspot.com/ http://xtalk.msk.su/~ott/

On 10/31/07, Alex Ott <alexott@gmail.com> wrote:
Thanks Alex! This popped up in my Google search, but I haven't given it that much thought yet -- I haven't found suitable documentation to support certain features, like task cancellation or interrupting the thread processing for whatever reason: which Boost.Asio's io_service handles pretty well. Would anybody else (Philipp, are you here?) know whether this will eventually be reviewed for inclusion in Boost? -- Dean Michael C. Berris Software Engineer, Friendster, Inc. [http://cplusplus-soup.blogspot.com/] [mikhailberis@gmail.com] [+63 928 7291459] [+1 408 4049523]

Hello Michael I had wrote this question to Phillip several days ago, so i know this asnwer ;-) After improvements in documentations, he plans to send it to review On 10/31/07, Dean Michael Berris <mikhailberis@gmail.com> wrote:
-- With best wishes, Alex Ott, MBA http://alexott.blogspot.com/ http://alexott-ru.blogspot.com/ http://content-filtering.blogspot.com/ http://xtalk.msk.su/~ott/

On 10/31/07, Alex Ott <alexott@gmail.com> wrote:
Great! Thanks. :-) At any rate, I think I'll contact him about helping with the documentation. It might also be a good idea if I take my further questions about thread pool with him directly. Thanks again! -- Dean Michael C. Berris Software Engineer, Friendster, Inc. [http://cplusplus-soup.blogspot.com/] [mikhailberis@gmail.com] [+63 928 7291459] [+1 408 4049523]

Hi all, I was amazed about the huge interest in my threadpool lib in the last week. :-) Currently, it looks like there's a strong demand for having a thread pool included in boost. Anthony would like to add futures and a pool to boost::thread. I think this is a very good idea for two reasons. First, any boost thread pool should be based on boost::thread. This means platform independence for free. It does not make much sense to separate the libs because the threadpool part is small and requires the boost::thread binaries anyway. Second, we don't need a boost project setup for my lib. I guess it's much easier to integrate with boost::threads than to prepare a stand-alone library. Please let me know your opinions. Regards, Philipp On 10/31/07, Dean Michael Berris <mikhailberis@gmail.com> wrote:

Hello all PH> Hi all, I was amazed about the huge interest in my threadpool lib in PH> the last week. :-) Currently, it looks like there's a strong demand PH> for having a thread pool included in boost. Anthony would like to add PH> futures and a pool to boost::thread. I think this is a very good idea PH> for two reasons. First, any boost thread pool should be based on PH> boost::thread. This means platform independence for free. It does not PH> make much sense to separate the libs because the threadpool part is PH> small and requires the boost::thread binaries anyway. Second, we PH> don't need a boost project setup for my lib. I guess it's much easier PH> to integrate with boost::threads than to prepare a stand-alone PH> library. PH> Please let me know your opinions. I think, that at first stage we'll need to has 2 options - one stand-alone library, ready to quick rollout together with current boost release (1.35 for example), and in parallel port it to include into boost distribution for a next release (1.36?) after review -- With best wishes, Alex Ott, MBA http://alexott.blogspot.com/ http://content-filtering.blogspot.com/ http://alexott-ru.blogspot.com/ http://content-filtering-ru.blogspot.com/ http://xtalk.msk.su/~ott/

First of all there needs to be a review before it can be included into the Boost distribution. Adjusting the lib to be compatible with Boost (is that what you mean by 'quick rollout together with boost release'?) is certainly something completely independent and could be done by the author immediately. Regards Hartmut
participants (4)
-
Alex Ott
-
Dean Michael Berris
-
Hartmut Kaiser
-
Philipp Henkel