[llvm-commits] [llvm] r73806 - /llvm/trunk/lib/System/RWMutex.cpp
Owen Anderson
resistor at mac.com
Fri Jun 19 17:32:27 PDT 2009
Author: resistor
Date: Fri Jun 19 19:32:27 2009
New Revision: 73806
URL: http://llvm.org/viewvc/llvm-project?rev=73806&view=rev
Log:
Workaround for an... interesting bug in Darwin's pthread_rwlock_init.
Modified:
llvm/trunk/lib/System/RWMutex.cpp
Modified: llvm/trunk/lib/System/RWMutex.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/System/RWMutex.cpp?rev=73806&r1=73805&r2=73806&view=diff
==============================================================================
--- llvm/trunk/lib/System/RWMutex.cpp (original)
+++ llvm/trunk/lib/System/RWMutex.cpp Fri Jun 19 19:32:27 2009
@@ -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 @@
// 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
More information about the llvm-commits
mailing list