Boost logo

Boost :

From: Christopher Kohlhoff (chris_at_[hidden])
Date: 2005-08-19 20:30:19

Hi Ariel,

--- Ariel Badichi <abadichi_at_[hidden]> wrote:
> I experimented with the library for a few days now. Maybe I'm
> misusing it, but it seemed nice to have demuxer::run() thread(s)
> running before any (meaningful) asio operation is performed.
> My solution was a demuxer::run() thread pool management class (using
> boost::thread_group to manage the threads themselves). The class has
> a
> timer that keeps queueing itself in its handler, unless the class's
> client requested it to stop. The stop operation also joins the
> thread(s).

There's a simpler way to do what you want. Just call
demuxer.work_started() before calling, and then call
demuxer.work_finished() when you're ready to shut down.

These functions are provided to ensure that does not exit
 when an asynchronous operation (the "work") is being carried out by
something external to the demuxer (such as a thread).

> My instinct tells me that they shouldn't be merged: they are very
> different concepts, and I wouldn't like this specific abstraction
> eliminated in asio.

Fair enough. I'll leave them as separate for now.


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