Boost logo

Boost :

Subject: Re: [boost] Contributing a thread pool class
From: Oliver Kowalke (oliver.kowalke_at_[hidden])
Date: 2012-09-28 05:44:34


> Hello,
>
> It seems that boost's "thread" library does not have a thread pool class.
> It does have a thread_group class but this class is has the following
> limitations:
>
> 1. It does not limit the number of threads created.
>
> 2. Threads added are not managed and raw pointers are used exposing
> the developer to memory leaks.
>
> 3. The API deals with threads and not "tasks" to be executed by a
> thread.
>
> As such I have developed a thread pool class which allows for:
>
> · A maximum number of "worker" threads to configured.
>
> · Arbitrary "tasks" to be submitted by any thread and executed by
> one of the worker threads.
>
> o Worker threads are created as and when needed.
>
> · Worker threads can terminate after being idle a configurable
> amount of time.
>
> o They will be re-created if needed afterwards.
>
> The amount of code is quite small (< 500 lines including blank lines, API
> usage document in the header file and comments) and just uses standard C++
> and boost thread functionality.
>
> My question is, would the boost community be interested in such a
> contribution to the thread library? I apologize in advance if this is the Nth
> time such a contribution has been proposed and rejected.
>
> I have developed this while working for my employer (a French bank called
> Société Générale). I have my manager's support and am in the process
> of obtaining agreement from my employer to get permission to submit the
> thread pool class developed.

such a library should also provide work-stealing and fork-join semantics


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk