Skip to content
This repository has been archived by the owner on Jan 25, 2022. It is now read-only.

Write->read causality with futexWait returning NOTEQUAL #58

Closed
lars-t-hansen opened this issue Feb 4, 2016 · 2 comments
Closed

Write->read causality with futexWait returning NOTEQUAL #58

lars-t-hansen opened this issue Feb 4, 2016 · 2 comments

Comments

@lars-t-hansen
Copy link
Collaborator

Not sure if this is already implied by the current happens-before relation and other spec prose but I think it should be spelled out. There's already a happens-before relation from Atomics.futexWake to Atomics.futexWait if the wake does wake the waiter, ie, the futexWait returns OK. But what if futexWait returns NOTEQUAL? In that case that relation does not apply. However, it should be specified that futexWait does perform an atomic read of the location at the outset, so that if NOTEQUAL is returned there is a write->read relationship between the write that set the value and the futexWait. This means that the usual pattern, where a waking thread first updates the value and then calls futexWait, is in the proper relationship with a thread that calls futexWait regardless of whether futexWait returns with OK or NOTEQUAL.

(See a comment on Issue #56 for background.)

@jfbastien
Copy link
Contributor

Not to belabor the point, but #12 synchronic's wording ensures this :-)

@lars-t-hansen
Copy link
Collaborator Author

That's right, rub it in :-)

The existing wording in the spec might even ensure this too, or it might ensure it with a little tweak that exposes the atomic read in futexWait.

lars-t-hansen pushed a commit that referenced this issue Feb 10, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants