Overview
| Artifact ID: | 667ebd0d64355d56865e6f8af9d7493eb4a9ab6a |
|---|---|
| Ticket: | 3328635fffffffffffffffffffffffffffffffff
Virtual Time broken on threaded unix |
| User & Date: | dgp on 2014-10-09 14:33:10 |
Changes
- assignee changed to: "aku"
- closer changed to: "nobody"
- comment changed to:
In threaded unix builds, timer events use pthread_cond_timedwait, which needs an absolute target time. The computation of this target is broken, because it adds the (correct) scaled==real delta to the (incorrect) virtual Tcl_GetTime. The fix is to use real time for the latter. Moreover, in some unices, the clock used for pthread_cond_timedwait can be selected among several, with pthread_condattr_setclock at condvar creation time. One of them, CLOCK_MONOTONIC, has the extra advantage of being insensitive to system clock tweaks. I think that selecting it when possible can only improve things, since it allows: - usual, tip-302-sensitive [after] semantics unchanged, since the timer events are also stored as absolute epoch-time targets by Tcl - fully working Virtual Time with clock_gettime(CLOCK_MONOTONIC) giving tip-302-insensitive [after]. I have a provisional patch for platforms with clock_gettime+CLOCK_MONOTONIC, designed to enable Joe Keen's code in http://groups.google.com/group/comp.lang.tcl/browse_frm/thread/8f820c68143850f9# . Some autogoo would be due before committing. An alternative to 'select monotonic if possible, epoch if not' would be a runtime setting, like a ::tcl::unsupported::monotonicTime linked var. To be discussed. - icomment: "status?"
- login: "dgp"
- mimetype: "text/plain"
- severity changed to: "Minor"