diff options
author | deanm@chromium.org <deanm@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-10-01 14:45:24 +0000 |
---|---|---|
committer | deanm@chromium.org <deanm@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-10-01 14:45:24 +0000 |
commit | f9b05c2dd900aa1850111c4a052db0da6e060a5a (patch) | |
tree | 40976d26ce38fc88d3395335338c102bf7b59454 /base | |
parent | b4fef872bdb00afec096a716cfe05f2c3d600850 (diff) | |
download | chromium_src-f9b05c2dd900aa1850111c4a052db0da6e060a5a.zip chromium_src-f9b05c2dd900aa1850111c4a052db0da6e060a5a.tar.gz chromium_src-f9b05c2dd900aa1850111c4a052db0da6e060a5a.tar.bz2 |
Enable error checking on Posix locks in debug, and make release lock creation do a little bit less work. Based on suggestions by Gaetano Mendola.
Review URL: http://codereview.chromium.org/6038
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@2755 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base')
-rw-r--r-- | base/lock_impl_posix.cc | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/base/lock_impl_posix.cc b/base/lock_impl_posix.cc index a6da57d..6c70436 100644 --- a/base/lock_impl_posix.cc +++ b/base/lock_impl_posix.cc @@ -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 } LockImpl::~LockImpl() { |