[PATCH] D14745: [tsan] Implement basic GCD interceptors for OS X

Dmitry Vyukov via llvm-commits llvm-commits at lists.llvm.org
Tue Nov 17 05:51:09 PST 2015


dvyukov added a comment.

Doh! Don't know whether I need to laugh or cry.
If you mean this one:
http://www.opensource.apple.com/source/libdispatch/libdispatch-339.1.9/dispatch/once.h
It does contain real, harmful data race. Load of predicate on fast path must be an atomic load with acquire memory ordering.

First we need to fix the actual bug in libdispatch.
Then you can do the same thing I did for pthread_once. Namely, reimplement dispatch_once entirely expecting that the inlined fast-path will load acquire load of the predicate address.


http://reviews.llvm.org/D14745





More information about the llvm-commits mailing list