diff options
author | Owen Anderson <resistor@mac.com> | 2009-06-20 00:32:27 +0000 |
---|---|---|
committer | Owen Anderson <resistor@mac.com> | 2009-06-20 00:32:27 +0000 |
commit | 912d180a5474edd3cc355cdf44d1f18c4b9b4c3a (patch) | |
tree | a47ed18953b72fb675b4a5fd1aa71abe1bf7a42d /lib/System/RWMutex.cpp | |
parent | 92369c323af91c5d7ffd1db40239b3e3bf6e7cda (diff) | |
download | external_llvm-912d180a5474edd3cc355cdf44d1f18c4b9b4c3a.tar.gz external_llvm-912d180a5474edd3cc355cdf44d1f18c4b9b4c3a.tar.bz2 external_llvm-912d180a5474edd3cc355cdf44d1f18c4b9b4c3a.zip |
Workaround for an... interesting bug in Darwin's pthread_rwlock_init.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73806 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/System/RWMutex.cpp')
-rw-r--r-- | lib/System/RWMutex.cpp | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/lib/System/RWMutex.cpp b/lib/System/RWMutex.cpp index cf1aea03dd..15d98cb8f4 100644 --- a/lib/System/RWMutex.cpp +++ b/lib/System/RWMutex.cpp @@ -13,6 +13,7 @@ #include "llvm/Config/config.h" #include "llvm/System/RWMutex.h" +#include <cstring> //===----------------------------------------------------------------------===// //=== WARNING: Implementation here must contain only TRULY operating system @@ -64,6 +65,12 @@ RWMutexImpl::RWMutexImpl() // Declare the pthread_rwlock data structures pthread_rwlock_t* rwlock = static_cast<pthread_rwlock_t*>(malloc(sizeof(pthread_rwlock_t))); + +#ifdef __APPLE__ + // Workaround a bug/mis-feature in Darwin's pthread_rwlock_init. + bzero(rwlock, sizeof(pthread_rwlock_t)); +#endif + pthread_rwlockattr_t attr; // Initialize the rwlock attributes |