summaryrefslogtreecommitdiff
path: root/common
diff options
context:
space:
mode:
authorJose Fonseca <jfonseca@vmware.com>2015-11-09 22:23:01 +0000
committerJose Fonseca <jfonseca@vmware.com>2015-11-09 22:23:24 +0000
commit57cb446f0f33f2d4d575b3462a004e4d0cf3dcc0 (patch)
treef5e6925265426ea6e97d7412731ff6b35a8c9b65 /common
parente76ff4b6b6357cf5c54dfafefbef8d1f2692db85 (diff)
os: Initialize native mutex only once.
The derived mutex classes are responsible for initializing the native mutex.
Diffstat (limited to 'common')
-rw-r--r--common/os_thread.hpp11
1 files changed, 2 insertions, 9 deletions
diff --git a/common/os_thread.hpp b/common/os_thread.hpp
index 9f1f978f..830ceb06 100644
--- a/common/os_thread.hpp
+++ b/common/os_thread.hpp
@@ -90,18 +90,11 @@ namespace os {
typedef pthread_mutex_t native_handle_type;
#endif
+ protected:
_base_mutex(void) {
-#ifdef _WIN32
- InitializeCriticalSection(&_native_handle);
-#else
- pthread_mutexattr_t attr;
- pthread_mutexattr_init(&attr);
- pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE);
- pthread_mutex_init(&_native_handle, &attr);
- pthread_mutexattr_destroy(&attr);
-#endif
}
+ public:
~_base_mutex() {
#ifdef _WIN32
DeleteCriticalSection(&_native_handle);