Boost logo

Boost :

From: Atry (pop.atry_at_[hidden])
Date: 2007-05-07 07:51:29


Christopher Kohlhoff 写道:
> 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.
>
> Cheers,
> Chris
> _______________________________________________
> Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost
>
>
Yes. But in most cases only fixed number of threads is needed, so I
think io_service is enough.
And I have another question. Do we need to implement another message
queue or dispatcher if we need another event handler in a special case,
such as gui or thread pool? Or, we have only one public interface (like
io_service) for a "event queue", and repost any native event/message to it?


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