Boost logo

Boost :

Subject: [boost] Contributing a thread pool class
From: BOLTON Gawain (gawain.bolton_at_[hidden])
Date: 2012-09-27 11:21:06


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.

Cheers,

Gawain Bolton
Domino Development
ITEC/CTT/GEF/TED
17 cours Valmy
92 800 Puteaux
France
Telephone : +33 1 42 13 52 43

*************************************************************************
This message and any attachments (the "message") are confidential, intended solely for the addressee(s), and may contain legally privileged information.
Any unauthorised use or dissemination is prohibited. E-mails are susceptible to alteration.
Neither SOCIETE GENERALE nor any of its subsidiaries or affiliates shall be liable for the message if altered, changed or
falsified.
                              ************
Ce message et toutes les pieces jointes (ci-apres le "message") sont confidentiels et susceptibles de contenir des informations couvertes
par le secret professionnel.
Ce message est etabli a l'intention exclusive de ses destinataires. Toute utilisation ou diffusion non autorisee est interdite.
Tout message electronique est susceptible d'alteration.
La SOCIETE GENERALE et ses filiales declinent toute responsabilite au titre de ce message s'il a ete altere, deforme ou falsifie.
*************************************************************************


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