Boost logo

Boost :

Subject: Re: [boost] [timer_scheduler] is there any interest on a timerscheduler library?
From: vicente.botet (vicente.botet_at_[hidden])
Date: 2008-11-03 08:08:11


----- Original Message -----
From: "Giovanni Piero Deretta" <gpderetta_at_[hidden]>
To: <boost_at_[hidden]>
Sent: Monday, November 03, 2008 12:36 PM
Subject: Re: [boost] [timer_scheduler] is there any interest on a
timerscheduler library?

>
> On Mon, Nov 3, 2008 at 12:17 PM, vicente.botet <vicente.botet_at_[hidden]>
> wrote:
>> Hi,
>>
>> I would like to be able to submit/schedule tasks at a given time
>> (callouts)
>> which could
>> be oneshot or periodics. Something like
>>
>> the_timer_scheduler::schedule_at(t1_, now()+seconds(10));
>>
>> Is there any interest on this feature?
>>
>> I have started to scketch the interface of the library.
>>
>
> How is it better than Asio's timer completion callbacks?

I don't think we can say it is better or worst. The timer_scheduler is a low
level facility that could be used by the Asio's deadline_timer as
TimerScheduler (with some adaptations of course), directly by the end user
or by other general purpose library.

One of the advantages could be the size of the code, the other could be the
performances.
I don't know all the details of the asio TimerScheduler implementation but
it seems to me that most of the TimerScheduler operations depends on the
number of running timers on the queue and so they are O(n). The
implementation this will be based uses a weel which allows to have most of
the operation in constant time. See the reference on the preceding mail for
more information. Of course the asio library could implement implement
directly a TimerScheduler based on this implementation.

On the other side the timeout function is called from the timer_scheduler
interruption thread and so some kind of synchronization could be needed by
the user.

Vicente


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