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

wasi-threads: fix use of wait in test #5858

Merged
merged 1 commit into from
Feb 23, 2023

Conversation

abrown
Copy link
Contributor

@abrown abrown commented Feb 23, 2023

As @yamt points out here, the wait/notify pairing used in this manual WAT test was not effective. The wait always immediately returned, meaning that the main thread essentially spins until a counter is atomically incremented. This is fine for test correctness, but was not the original intent, which was lost in a refactoring. This change uses the $i local to keep track of the counter value we expect to see for the wait, so that the wait/notify pair actually waits as expected.

As @yamt points out [here], the `wait`/`notify` pairing used in this
manual WAT test was not effective. The `wait` always immediately
returned, meaning that the main thread essentially spins until a counter
is atomically incremented. This is fine for test correctness, but was
not the original intent, which was lost in a refactoring. This change
uses the `$i` local to keep track of the counter value we expect to see
for the `wait`, so that the `wait`/`notify` pair actually waits as
expected.

[here]: bytecodealliance#5484 (comment)
@alexcrichton alexcrichton added this pull request to the merge queue Feb 23, 2023
Merged via the queue into bytecodealliance:main with commit f6b16a7 Feb 23, 2023
@abrown abrown deleted the fix-threads-test branch February 23, 2023 20:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants