Daniel A. Steffen | 7 Jul 19:45
Gravatar

Re: after ids


On 07/07/2008, at 16:44, Kevin Kenny wrote:

>> 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()).
>
> Is it really true that pthread_cond_timedwait uses an absolute time?
> That would imply that every pthreads process that's waiting for a
> timer will freeze if the system clock ever jumps backwards. Do
> other things freeze on Darwin in that case?

no, as I have just discovered, while pthread_cond_timedwait takes an  
absolute time, it does in fact just wait for the relative interval to  
the value of gettimeofday() at the start of the call (i.e. if calendar  
time is adjusted/changed during  the waiting, the kernel does not  
update the timeouts AFAICT).

> It's not, strictly speaking, necessary to have functions that wait
> for both absolute and relative times. It's good enough
> if a wait can be interrupted when the system clock is reset.

agreed, Darwin sends a host notification when calendar time is changed  
via  settimeofday() (but not for adjustments due to adjtime()), it  
might take a separate thread to integrate listening to that  
notification into the tcl notifier though, I'd have to look into it.

Cheers,

Daniel

--

-- 
** Daniel A. Steffen                   **
** <mailto:das@...>  **


-------------------------------------------------------------------------
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

Gmane