-
Couldn't load subscription status.
- Fork 305
Open
Description
Possible scenario:
- Assuming the context wasn't initialized yet
- Threads A and B loaded
HAVE_PREALLOCATED_CONTEXT - Thread A is suspended by the OS
- Thread B initializes the context and stores
DONE - Thread A is scheduled and swaps DONE for
WORKING - Thread C loads
WORKING - Thread A sees the mistake and stores
DONEagain - Thread C can now continue
In this scenario C needlessly waited for A even though the context was initialized. I suggest to use compare exchange to avoid erroneous swapping in the first place.
There's also break missing so B always makes one more iteration of the loop and may even ironically become thread C.
Metadata
Metadata
Assignees
Labels
No labels