You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[Fake clock] Make Stop / Reset return false if Timer stopped (#320)
* [Fake clock] Make Stop / Reset return false if Timer stopped
In order to conform to the standard library Timer, Stop and Reset should
return false if the Timer has already been stopped, which was not the
case previously.
We add unit tests to validate the new implementation. The updated
TestFakeStop test case and the new TestFakeReset/reset_stopped_timer
case fail with the old implementation.
We also simplify the implementation of Stop and Rest in the following
way: there is no need to check f.waiter.fired to determine whether a
Timer has expired. For Timers, this flag is set atomically with the
waiter being removed from the waiters list. As a result, we only check
for absence of the waiter from the list, which either indicates that the
Timer has been stopped or that it has already expired (fired).
Signed-off-by: Antonin Bas <[email protected]>
* Address review comments
Removed unused fired field for waiters.
Signed-off-by: Antonin Bas <[email protected]>
---------
Signed-off-by: Antonin Bas <[email protected]>
0 commit comments