Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
nim-lang#55 Remove smart-ptr data-race
Using the memory order "Release" here enables a data-race according to tsan. The data-race being *potentially* a false-positive. The race it identifies is between 2 threads both trying to destroy the smartPtr at the same time. They'll both call the decr proc in smartptrs.nim:92 and get past the nil check. Then one of them might get past the second if check and deallocate the ptr. However, that should be impossible to lead to a data race. The count of 0 can only be reached *once* if you're the last thread. I can only assume compiler-order-reshuffling may enable a race here. Using the default mode (SeqCst) as well as Acquire Release (AcqRel) gets rid of said data-race.
- Loading branch information