Boost logo

Boost Users :

Subject: [Boost-users] [asio] Using asio for asynchronous event processing
From: Edward Diener (eldiener_at_[hidden])
Date: 2012-05-27 20:40:16


I do not understand the documentation for asio, or even if it pertains
to the programming problem I am trying to solve. The doc, for whatever
reason, is poor regarding practical use. But rather than complain about
the doc I will ask a specific problem related to what I am trying to do
and hopefully someone can help me or point me to something in the doc by
which I can understand how to use asio for my problem.

I need to design generalized asynchronous events triggered by an event
source and handled by an event handler. The event source would trigger
an event declared as a callable object, as in boost::function, and an
event handler would eventually handle the event asynchronously. The
event source and the event handler would be in different threads of an
application but not in different applications.

The event source triggers the event but does not block in any way
waiting for the event to be processed. The event source may subsequently
trigger other asynchronous events to be eventually handled in the same
way without blocking.

The event handler is able to check for events periodically from within
its own thread.

Each event itself could be a totally different callable object, but the
event source and the event handler both know the callable prototype for
any given event. The event source and the event handler are completely
disconnected in that neither knows about the other. For any given
asynchronous event there may be any number of event handlers when an
event is triggered.

Can I use asio to implement such a solution ?

The doc suggests that asio does not only deal in i/o events, such as
networking and sockets, but I could not understand whether it deals in
generalized asynchronous operations or not. The proactor pattern is
understandable but there appears to be nothing in the doc which connects
the elements of the proactor pattern to classes in asio. The basic
tutorial as well as the sockets tutorial does not enlighten me at all.
Hopefully someone here can help.


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net