7 Jul 16:08
Re: after ids
From: Alexandre Ferrieux <alexandre.ferrieux@...>
Subject: Re: after ids
Newsgroups: gmane.comp.lang.tcl.core
Date: 2008-07-07 14:08:58 GMT
Subject: Re: after ids
Newsgroups: gmane.comp.lang.tcl.core
Date: 2008-07-07 14:08:58 GMT
On 7/6/08, Daniel A. Steffen <das@...> wrote: > > All the implementations of relative timers in the OS (nanosleep(), > pthread_cond_timedwait_relative_np() etc) are based on this reference. So, the shell loop 'while :;do sleep 1;echo foo;done' should have visible quirks when someone sets the date, right ? Is the timeout in select() also based on this absolute clock ? > Finding a function that returns an monotonic time reference on a > system does not solve the problem of implementing relative timers in > Tcl however, you also need a way for the notifier to wait for a > relative time interval, e.g. the current threaded unix notifier > waiting is based on pthread_cond_timedwait(), which uses absolute time > (c.f. Tcl_ConditionWait()). That may be another reason to reform the threaded notifier, if you allow me that digression> Darwin has pthread_cond_timedwait_relative_np() for exactly this > purpose, I don't know if other systems have something equivalent. Don't know either but please notice that going to select() everywhere would solve the problem uniformly. The non-threaded unix notifer has no problem with relative timers, it's just that currently the value is recomputed based on absolute time when it needs be. > (converting next absolute timer fire to a relative > time interval may result in waiting for too long if there are changes > to the gettod base). That's exactly what happens today in Windows and unthreaded unix, since WaitForMultiple* (resp. select()) both take a relative timeout. See TIP302. -Alex ------------------------------------------------------------------------- Sponsored by: SourceForge.net Community Choice Awards: VOTE NOW! Studies have shown that voting for your favorite open source project, along with a healthy diet, reduces your potential for chronic lameness and boredom. Vote Now at http://www.sourceforge.net/community/cca08
> Darwin has pthread_cond_timedwait_relative_np() for exactly this
> purpose, I don't know if other systems have something equivalent.
Don't know either but please notice that going to select() everywhere
would solve the problem uniformly. The non-threaded unix notifer has
no problem with relative timers, it's just that currently the value is
recomputed based on absolute time when it needs be.
> (converting next absolute timer fire to a relative
> time interval may result in waiting for too long if there are changes
> to the gettod base).
That's exactly what happens today in Windows and unthreaded unix,
since WaitForMultiple* (resp. select()) both take a relative timeout.
See TIP302.
-Alex
-------------------------------------------------------------------------
Sponsored by: SourceForge.net Community Choice Awards: VOTE NOW!
Studies have shown that voting for your favorite open source project,
along with a healthy diet, reduces your potential for chronic lameness
and boredom. Vote Now at
RSS Feed