Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Atomics.compareExchange() should advise reading the returned value #28049

Closed
nraynaud opened this issue Jul 19, 2023 · 0 comments · Fixed by #33972
Closed

Atomics.compareExchange() should advise reading the returned value #28049

nraynaud opened this issue Jul 19, 2023 · 0 comments · Fixed by #33972
Labels
Content:JS JavaScript docs help wanted If you know something about this topic, we would love your help!

Comments

@nraynaud
Copy link

MDN URL

https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Atomics/compareExchange

What specific section or headline is this issue about?

No response

What information was incorrect, unhelpful, or incomplete?

I think the documentation for Atomics.compareExchange() should strongly advise users to check the returned value to learn if the exchange has happened or not. The sample code could also reflect that.

What did you expect to see?

A strong encouragement to read the result value and learn if the exchange happened, maybe an explanation as to what makes it a synchronization primitive, because at face value it might look like a random operation.

Do you have any supporting links, references, or citations?

https://en.wikipedia.org/wiki/Compare-and-swap#Example_application:_atomic_adder

Do you have anything more you want to share?

thank you for your work!

MDN metadata

Page report details
@nraynaud nraynaud added the needs triage Triage needed by staff and/or partners. Automatically applied when an issue is opened. label Jul 19, 2023
@github-actions github-actions bot added the Content:JS JavaScript docs label Jul 19, 2023
@Josh-Cena Josh-Cena added help wanted If you know something about this topic, we would love your help! and removed needs triage Triage needed by staff and/or partners. Automatically applied when an issue is opened. labels Jul 19, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Content:JS JavaScript docs help wanted If you know something about this topic, we would love your help!
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants