diff options
| author | Dmitry Vyukov <dvyukov@google.com> | 2015-06-30 17:23:29 +0000 |
|---|---|---|
| committer | Dmitry Vyukov <dvyukov@google.com> | 2015-06-30 17:23:29 +0000 |
| commit | 1d9b5e6eced452c671e77ac924bd1fd4808716ee (patch) | |
| tree | d8287c2f86f35b45d9bacd439a45513056cf9bc7 /compiler-rt/lib/tsan/rtl/tsan_interceptors.cc | |
| parent | 01ee64c2eaf996a5360a4a81f12c260868e107fd (diff) | |
| download | bcm5719-llvm-1d9b5e6eced452c671e77ac924bd1fd4808716ee.tar.gz bcm5719-llvm-1d9b5e6eced452c671e77ac924bd1fd4808716ee.zip | |
tsan: fix handling of condition variable destruction
POSIX states that "It shall be safe to destroy an initialized condition
variable upon which no threads are currently blocked", and later clarifies
"A condition variable can be destroyed immediately after all the threads
that are blocked on it are awakened) (in examples section). Tsan reported
such destruction as a data race.
Fixes https://llvm.org/bugs/show_bug.cgi?id=23616
Reviewed in http://reviews.llvm.org/D10693
llvm-svn: 241082
Diffstat (limited to 'compiler-rt/lib/tsan/rtl/tsan_interceptors.cc')
| -rw-r--r-- | compiler-rt/lib/tsan/rtl/tsan_interceptors.cc | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/compiler-rt/lib/tsan/rtl/tsan_interceptors.cc b/compiler-rt/lib/tsan/rtl/tsan_interceptors.cc index d3bef355ded..7b5c50e2ad3 100644 --- a/compiler-rt/lib/tsan/rtl/tsan_interceptors.cc +++ b/compiler-rt/lib/tsan/rtl/tsan_interceptors.cc @@ -992,8 +992,8 @@ INTERCEPTOR(int, pthread_cond_init, void *c, void *a) { INTERCEPTOR(int, pthread_cond_wait, void *c, void *m) { void *cond = init_cond(c); SCOPED_TSAN_INTERCEPTOR(pthread_cond_wait, cond, m); - MutexUnlock(thr, pc, (uptr)m); MemoryAccessRange(thr, pc, (uptr)c, sizeof(uptr), false); + MutexUnlock(thr, pc, (uptr)m); CondMutexUnlockCtx arg = {&si, thr, pc, m}; int res = 0; // This ensures that we handle mutex lock even in case of pthread_cancel. @@ -1014,8 +1014,8 @@ INTERCEPTOR(int, pthread_cond_wait, void *c, void *m) { INTERCEPTOR(int, pthread_cond_timedwait, void *c, void *m, void *abstime) { void *cond = init_cond(c); SCOPED_TSAN_INTERCEPTOR(pthread_cond_timedwait, cond, m, abstime); - MutexUnlock(thr, pc, (uptr)m); MemoryAccessRange(thr, pc, (uptr)c, sizeof(uptr), false); + MutexUnlock(thr, pc, (uptr)m); CondMutexUnlockCtx arg = {&si, thr, pc, m}; int res = 0; // This ensures that we handle mutex lock even in case of pthread_cancel. |

