Boost logo

Boost :

From: Christopher Kohlhoff (chris_at_[hidden])
Date: 2006-03-20 07:08:29

Hi Vaclav,

--- Vaclav Vesely <vaclav.vesely_at_[hidden]> wrote:
> I'm very impressed with Asio library proposal. What I'm
> missing is a description (or even tutorial) about creating
> custom asynchronous providers.
> I have an object which don't sends events, but I have to ask
> it for events. I have to create a thread for for this task.
> What I want to do is an Asio wrapper for this object that will
> create the worker thread behind and will dispatch events
> through Asio demuxer.
> Can you point to an documentation, example or something what
> will help me? Thank you in advance.

Have a look at the example in src/examples/services, in
particular the logger-related classes. The logger_service uses a
background thread, with a private demuxer object to dispatch the

One thing that you said you wanted, but this example doesn't do,
is dispatching the events through the main demuxer. However that
should just be a matter of calling with an
appropriate handler object.

You might also want to take a look at the implementation of the
ipv4::host_resolver. The host_resolver_service emulates
asynchronous host resolution using a background thread to call
blocking functions like gethostbyname.


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