-
Notifications
You must be signed in to change notification settings - Fork 18
Open
Labels
readyThis issue is fixed. It awaits to be released.This issue is fixed. It awaits to be released.
Milestone
Description
@xhanin has kindly brought to my attention the fact that the the current implementation of the DefaultClock (#44) is not perfect. Indeed, the delay field could benefit from the same volatile protection as it has been done for the running field (#20).
Although very unlikely, in the JBotSim use-case described thereafter, a modification made with setTimeUnit() could not be taken into account. Scenario:
- someone actually wants to modify the delay of the
DefaultClockwhile the clock is running; it is generally intended to be used without user interactions. - we get very unlucky with CPU caching.
Aside from this unlikely use-case, if someone were to take the DefaultClock as an inspiration for any implementation involving threads, locks and conditions, this might result in spreading an incorrect implementation.
If not to be fixed, I think that at least adding a comment to the delay field would be nice.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
readyThis issue is fixed. It awaits to be released.This issue is fixed. It awaits to be released.