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

Wait until condition confirmation in atomic operations (try once methods) #5579

Merged
merged 2 commits into from Jan 22, 2019

Conversation

Projects
None yet
2 participants
@elad335
Copy link
Contributor

elad335 commented Jan 20, 2019

Do not abort prematurely on failed cmpxchg, restart the atomic loop and wait for condition confirmation instead.

Example: two threads are executing semaphore trywait at the same time on semaphore with an initial value of 2.
Ideally, both should succeed and return CELL_OK.
On the current method, when the first thread decreements the sema's value while the second thread is in the middle of trywait operation, the second thread will fail to store due to failed cmpxchg. (EBUSY is returned)
With an atomic loop restart the second thread will restart the atomic loop and reload the semaphore value, check it and decrement its value, both operations return CELL_OK.

Condition confirmation is important in try once methods.

elad335 and others added some commits Jan 20, 2019

Wait until condition confirmation in atomic operations
Do not abort on failed cmpxchg, this matters for trylock/wait methods

@Nekotekina Nekotekina merged commit afeacc1 into RPCS3:master Jan 22, 2019

2 checks passed

continuous-integration/appveyor/pr AppVeyor build succeeded
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details

@elad335 elad335 deleted the elad335:atomic_loops branch Jan 23, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.