diff options
author | Mark Benvenuto <mark.benvenuto@mongodb.com> | 2015-06-20 00:22:50 -0400 |
---|---|---|
committer | Mark Benvenuto <mark.benvenuto@mongodb.com> | 2015-06-20 10:56:02 -0400 |
commit | 9c2ed42daa8fbbef4a919c21ec564e2db55e8d60 (patch) | |
tree | 3814f79c10d7b490948d8cb7b112ac1dd41ceff1 /src/mongo/util/concurrency/mutex.h | |
parent | 01965cf52bce6976637ecb8f4a622aeb05ab256a (diff) | |
download | mongo-9c2ed42daa8fbbef4a919c21ec564e2db55e8d60.tar.gz |
SERVER-18579: Clang-Format - reformat code, no comment reflow
Diffstat (limited to 'src/mongo/util/concurrency/mutex.h')
-rw-r--r-- | src/mongo/util/concurrency/mutex.h | 92 |
1 files changed, 47 insertions, 45 deletions
diff --git a/src/mongo/util/concurrency/mutex.h b/src/mongo/util/concurrency/mutex.h index 1e21f81f392..65b0ae6b73a 100644 --- a/src/mongo/util/concurrency/mutex.h +++ b/src/mongo/util/concurrency/mutex.h @@ -38,64 +38,66 @@ namespace mongo { - /** The concept with SimpleMutex is that it is a basic lock/unlock - * with no special functionality (such as try and try - * timeout). Thus it can be implemented using OS-specific - * facilities in all environments (if desired). On Windows, - * the implementation below is faster than boost mutex. - */ +/** The concept with SimpleMutex is that it is a basic lock/unlock + * with no special functionality (such as try and try + * timeout). Thus it can be implemented using OS-specific + * facilities in all environments (if desired). On Windows, + * the implementation below is faster than boost mutex. +*/ #if defined(_WIN32) - class SimpleMutex { - MONGO_DISALLOW_COPYING(SimpleMutex); - public: - SimpleMutex() { - InitializeCriticalSection( &_cs ); - } +class SimpleMutex { + MONGO_DISALLOW_COPYING(SimpleMutex); - ~SimpleMutex() { - if ( ! StaticObserver::_destroyingStatics ) { - DeleteCriticalSection(&_cs); - } - } +public: + SimpleMutex() { + InitializeCriticalSection(&_cs); + } - void lock() { - EnterCriticalSection( &_cs ); - } - void unlock() { - LeaveCriticalSection( &_cs ); + ~SimpleMutex() { + if (!StaticObserver::_destroyingStatics) { + DeleteCriticalSection(&_cs); } + } + + void lock() { + EnterCriticalSection(&_cs); + } + void unlock() { + LeaveCriticalSection(&_cs); + } - private: - CRITICAL_SECTION _cs; - }; +private: + CRITICAL_SECTION _cs; +}; #else - class SimpleMutex { - MONGO_DISALLOW_COPYING(SimpleMutex); - public: - SimpleMutex() { - verify( pthread_mutex_init(&_lock,0) == 0 ); - } +class SimpleMutex { + MONGO_DISALLOW_COPYING(SimpleMutex); - ~SimpleMutex() { - if ( ! StaticObserver::_destroyingStatics ) { - verify( pthread_mutex_destroy(&_lock) == 0 ); - } - } +public: + SimpleMutex() { + verify(pthread_mutex_init(&_lock, 0) == 0); + } - void lock() { - verify( pthread_mutex_lock(&_lock) == 0 ); + ~SimpleMutex() { + if (!StaticObserver::_destroyingStatics) { + verify(pthread_mutex_destroy(&_lock) == 0); } + } - void unlock() { - verify( pthread_mutex_unlock(&_lock) == 0 ); - } + void lock() { + verify(pthread_mutex_lock(&_lock) == 0); + } + + void unlock() { + verify(pthread_mutex_unlock(&_lock) == 0); + } - private: - pthread_mutex_t _lock; - }; +private: + pthread_mutex_t _lock; +}; #endif -} // namespace mongo +} // namespace mongo |