Boost logo

Boost Users :

Subject: Re: [Boost-users] Fwd: [naive] relationship between deadline_timer and io_service
From: Michael Caisse (boost_at_[hidden])
Date: 2010-07-08 13:02:21


Ernest Galbrun wrote:
> Dear Boost community,
>
> I have a rather simple question (some would say dumb) : I have been
> using the deadline_timer in asio library for a couple of hours, but I
> don't get why it is associated with an io_service (in fact, I don't
> get why this is in this library rather than in the date_time or timer
> library).
>
> I know it may seem trivial, but it is not to me, and I am worried I am
> missing something.
>
> regards,
>
> Ernest Galbrun.

Ernest -

Asio provides a proactor implementation that is useful for many
asynchronous tasks. It happens to provide a timer service which you are
using with deadline_timer.

So, why is deadline_timer associated with io_service? Because the
io_service is part of the proactor.

Why not in a different library? There maybe other timer facilities in
other libraries; however, it is very common to need timers in an
asynchronous design. Having a timer service makes good sense.

You are approaching the problem from a "I need a timer" point-of-view.
Why the deadline_timer is part of Asio is answered from the "what is
part of an async-IO library" point-of-view.

If you are not familiar with the proactor and how it works, this link
may be useful:

<http://www.objectmodelingdesigns.com/boostcon10/asio_presentation_with_story.pdf>

hth -
michael

-- 
----------------------------------
Michael Caisse
Object Modeling Designs
www.objectmodelingdesigns.com

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