{"action":"created","issue":{"url":"https://api.github.com/repos/tc39/ecmascript_sharedmem/issues/58","repository_url":"https://api.github.com/repos/tc39/ecmascript_sharedmem","labels_url":"https://api.github.com/repos/tc39/ecmascript_sharedmem/issues/58/labels{/name}","comments_url":"https://api.github.com/repos/tc39/ecmascript_sharedmem/issues/58/comments","events_url":"https://api.github.com/repos/tc39/ecmascript_sharedmem/issues/58/events","html_url":"https://github.com/tc39/ecmascript_sharedmem/issues/58","id":131330994,"number":58,"title":"Write->read causality with futexWait returning NOTEQUAL","user":{"login":"lars-t-hansen","id":4823190,"avatar_url":"https://avatars.githubusercontent.com/u/4823190?v=3","gravatar_id":"","url":"https://api.github.com/users/lars-t-hansen","html_url":"https://github.com/lars-t-hansen","followers_url":"https://api.github.com/users/lars-t-hansen/followers","following_url":"https://api.github.com/users/lars-t-hansen/following{/other_user}","gists_url":"https://api.github.com/users/lars-t-hansen/gists{/gist_id}","starred_url":"https://api.github.com/users/lars-t-hansen/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lars-t-hansen/subscriptions","organizations_url":"https://api.github.com/users/lars-t-hansen/orgs","repos_url":"https://api.github.com/users/lars-t-hansen/repos","events_url":"https://api.github.com/users/lars-t-hansen/events{/privacy}","received_events_url":"https://api.github.com/users/lars-t-hansen/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/tc39/ecmascript_sharedmem/labels/Memory%20model","name":"Memory model","color":"0052cc"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2016-02-04T12:25:28Z","updated_at":"2016-02-04T16:36:44Z","closed_at":null,"body":"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.\r\n\r\n(See a comment on Issue #56 for background.)"},"comment":{"url":"https://api.github.com/repos/tc39/ecmascript_sharedmem/issues/comments/179934644","html_url":"https://github.com/tc39/ecmascript_sharedmem/issues/58#issuecomment-179934644","issue_url":"https://api.github.com/repos/tc39/ecmascript_sharedmem/issues/58","id":179934644,"user":{"login":"lars-t-hansen","id":4823190,"avatar_url":"https://avatars.githubusercontent.com/u/4823190?v=3","gravatar_id":"","url":"https://api.github.com/users/lars-t-hansen","html_url":"https://github.com/lars-t-hansen","followers_url":"https://api.github.com/users/lars-t-hansen/followers","following_url":"https://api.github.com/users/lars-t-hansen/following{/other_user}","gists_url":"https://api.github.com/users/lars-t-hansen/gists{/gist_id}","starred_url":"https://api.github.com/users/lars-t-hansen/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lars-t-hansen/subscriptions","organizations_url":"https://api.github.com/users/lars-t-hansen/orgs","repos_url":"https://api.github.com/users/lars-t-hansen/repos","events_url":"https://api.github.com/users/lars-t-hansen/events{/privacy}","received_events_url":"https://api.github.com/users/lars-t-hansen/received_events","type":"User","site_admin":false},"created_at":"2016-02-04T16:36:44Z","updated_at":"2016-02-04T16:36:44Z","body":"That's right, rub it in :-)\r\n\r\nThe 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."}}