Boost logo

Boost :

From: Dean Michael Berris (mikhailberis_at_[hidden])
Date: 2007-10-31 10:13:48

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;
        bind(&io_service::work, &process_queue)

  // add all void nullary functors and post them here;

  // once all the work has been queued, remove the sentinel


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.
[+63 928 7291459]
[+1 408 4049523]

Boost list run by bdawes at, gregod at, cpdaniel at, john at