[tsan] Add support for GCD dispatch_suspend and dispatch_resume
authorKuba Mracek <mracek@apple.com>
Thu, 24 Nov 2016 21:24:54 +0000 (21:24 +0000)
committerKuba Mracek <mracek@apple.com>
Thu, 24 Nov 2016 21:24:54 +0000 (21:24 +0000)
commitb59118f6ec3db2a53b36e5ebc85f77dde2aa6dfb
treeff45daae2384ecf9790d31413e0f26b28ba6ebbe
parent26081caf48a27d3de628db201fe71cc6a0fda356
[tsan] Add support for GCD dispatch_suspend and dispatch_resume

GCD queues can be suspended and resumed with dispatch_suspend and dispatch_resume. We need to add synchronization between the call to dispatch_resume and any subsequent executions of blocks in the queue that was resumed. We already have an Acquire(q) before the block executes, so this patch just adds the Release(q) in an interceptor of dispatch_resume.

Differential Revision: https://reviews.llvm.org/D27112

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