Opened 14 years ago

Closed 14 years ago

Last modified 14 years ago

#653 closed task (fixed)

Make timer_Time() threadsafe

Reported by: Philip Taylor Owned by:
Priority: Nice to Have Milestone: Alpha 3
Component: Core engine Keywords:
Cc: Jan Wassenberg Patch:

Description

timer_Time isn't thread-safe, due to t_last.

CLogger::PushRenderMessage uses it (to record the times when warnings/errors are logged), which may be called from a background thread.

If it's hard to fix, we could hack around it by having CLogger use a non-monotonic and/or low-precision timer instead, but it'd be nicer if the function worked.

(Incidentally, t_last+DBL_EPSILON seems wrong - if t_last >= 2.0 then I expect t_last+DBL_EPSILON == t_last. I don't think it'd necessarily be bad to remove that guarantee and expect callers to handle 0 (though still guarantee non-negative).)

Change History (2)

comment:1 by Jan Wassenberg, 14 years ago

Resolution: fixed
Status: newclosed

(In [8516]) thread-safe timer monotonicity check. fixes #653 (agree that DBL_EPSILON is an unnecessary hack, since division by (t+eps)-(t) will yield a number not much more useful than infinity)

comment:2 by Kieran P, 14 years ago

Milestone: BacklogAlpha 3
Note: See TracTickets for help on using tickets.