diff options
author | Kuba Brecka <kuba.brecka@gmail.com> | 2015-11-20 11:13:36 +0000 |
---|---|---|
committer | Kuba Brecka <kuba.brecka@gmail.com> | 2015-11-20 11:13:36 +0000 |
commit | 484b203292332d2ddcb47af684ef0182c8797ae4 (patch) | |
tree | f4337151434e770b2f6677fd2904ee1fdc4ae21d /test/tsan/deadlock_detector_stress_test.cc | |
parent | f802f1b27252e68fd149701b199e3ff602de5ad1 (diff) |
[tsan] Fix deadlock_detector_stress_test.cc testcase for OS X
On OS X, we don't have pthread spinlocks, let's just use a regular mutex instead. Secondly, pthread_rwlock_t is much larger (200 bytes), so `char padding_[64 - sizeof(pthread_rwlock_t)]` actually underflows.
Differential Revision: http://reviews.llvm.org/D14862
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@253659 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/tsan/deadlock_detector_stress_test.cc')
-rw-r--r-- | test/tsan/deadlock_detector_stress_test.cc | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/test/tsan/deadlock_detector_stress_test.cc b/test/tsan/deadlock_detector_stress_test.cc index 8af70b2af..41ad5818b 100644 --- a/test/tsan/deadlock_detector_stress_test.cc +++ b/test/tsan/deadlock_detector_stress_test.cc @@ -56,6 +56,7 @@ class PthreadRecursiveMutex : public PthreadMutex { static bool supports_recursive_lock() { return true; } }; +#ifndef __APPLE__ class PthreadSpinLock { public: PthreadSpinLock() { assert(0 == pthread_spin_init(&mu_, 0)); } @@ -76,6 +77,9 @@ class PthreadSpinLock { pthread_spinlock_t mu_; char padding_[64 - sizeof(pthread_spinlock_t)]; }; +#else +class PthreadSpinLock : public PthreadMutex { }; +#endif class PthreadRWLock { public: @@ -95,7 +99,7 @@ class PthreadRWLock { private: pthread_rwlock_t mu_; - char padding_[64 - sizeof(pthread_rwlock_t)]; + char padding_[256 - sizeof(pthread_rwlock_t)]; }; class LockTest { |