Boost logo

Boost :

From: Yuval Ronen (ronen_yuval_at_[hidden])
Date: 2007-05-07 13:06:39


Christopher Kohlhoff wrote:
> On Mon, 07 May 2007 07:18:33 +0300, "Yuval Ronen"
> <ronen_yuval_at_[hidden]> said:
>> Atry wrote:
>>> We already have thread pool and dispatcher in Boost.Asio, although it is
>>> a very simple one.
>> Oh, I didn't know that. Thanks for the pointer! Do they provide the same
>> functionality (in general, not up to the last feature)? I will take a
>> look at them. IMO, if they are like mine, they should reside in
>> Boost.Thread rather than in Asio.
>
> Asio doesn't include any functionality to spawn threads (in a pool or
> otherwise). However, the io_service class can be used to dispatch work
> items in a thread pool using a combination of io_service::post() and
> io_service::run(). It's the same mechanism that is used to dispatch
> completion handlers for asynchronous operations.

It seems that if my thread_pool will not spawn its own threads, but
instead provide a run() method, it will become similar (though not
identical) to asio::io_service. This is an interesting idea for me. I'm
quite fond of it.

At first sight it seems my dispatcher classes have the benefit of being
able to wait on multiple tasks (handlers) being executes concurrently.
Is that true? If so, do you see that as an important advantage?

Do you think that this functionality (of
thread_pool/dispatchers/asio::io_service) should be in Boost.Thread?
IMHO, it sounds as if it has more to do with "multi-threading policy"
than "I/O (sync or async)".


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