[tsan] Fix synchronization in dispatch_sync
authorKuba Brecka <kuba.brecka@gmail.com>
Thu, 7 Apr 2016 11:33:44 +0000 (11:33 +0000)
committerKuba Brecka <kuba.brecka@gmail.com>
Thu, 7 Apr 2016 11:33:44 +0000 (11:33 +0000)
commit33c15c91a674045a47eadb559d41c77d5997af66
tree559739a40a9760d6b5c3934ddb3c0c30c8334380
parentaafb41ae473576c1c06bf3d03dcb1fec15f7b711
[tsan] Fix synchronization in dispatch_sync

In the interceptor for dispatch_sync, we're currently missing synchronization between the callback and the code *after* the call to dispatch_sync. This patch fixes this by adding an extra release+acquire pair to dispatch_sync() and similar APIs. Added a testcase.

Differential Revision: http://reviews.llvm.org/D18502

llvm-svn: 265659
compiler-rt/lib/tsan/rtl/tsan_libdispatch_mac.cc
compiler-rt/test/tsan/Darwin/gcd-blocks.mm [new file with mode: 0644]