Index: base/lock_impl_posix.cc |
=================================================================== |
--- base/lock_impl_posix.cc (revision 2711) |
+++ base/lock_impl_posix.cc (working copy) |
@@ -9,15 +9,21 @@ |
#include "base/logging.h" |
LockImpl::LockImpl() { |
+#ifndef NDEBUG |
+ // In debug, setup attributes for lock error checking. |
pthread_mutexattr_t mta; |
int rv = pthread_mutexattr_init(&mta); |
DCHECK(rv == 0); |
- //rv = pthread_mutexattr_settype(&mta, PTHREAD_MUTEX_RECURSIVE); |
+ rv = pthread_mutexattr_settype(&mta, PTHREAD_MUTEX_ERRORCHECK); |
DCHECK(rv == 0); |
rv = pthread_mutex_init(&os_lock_, &mta); |
DCHECK(rv == 0); |
rv = pthread_mutexattr_destroy(&mta); |
DCHECK(rv == 0); |
+#else |
+ // In release, go with the default lock attributes. |
+ pthread_mutex_init(&os_lock_, NULL); |
+#endif |
mendola
2008/10/01 14:25:21
this is fine if we want an undefined behavior in c
|
} |
LockImpl::~LockImpl() { |