Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Eliminate TSAN error in benign race condition
In the following condition, a race condition occurs: ``` Thread A, B, and C all attempt to do a match on the same pattern. A: Allocates Machine 1; executes match; put machine 1. State is now: pooled -> machine 1 -> null B reads pooled, sees machine 1 C reads pooled, sees machine 1 B successfully CASes pooled to null B executes match; put machine 1, which involves setting machine1.next to null (even though it's already null); preempted before CAS C resumes, and reads machine1.next in order to execute cas(head, head.next) There is no happens-before relationship between B's redundant null write and C's read, thus triggering TSAN. ``` There is no consequence to the race, but the error is a nuisance. This should eliminate the error.
- Loading branch information