Index: ext/libicpf/src/mutex.h =================================================================== diff -u -re17c80d36eaa0430313e7d1058aa7a301d1510af -r28813ed68056ed023817951c1854bd73cc7d9e27 --- ext/libicpf/src/mutex.h (.../mutex.h) (revision e17c80d36eaa0430313e7d1058aa7a301d1510af) +++ ext/libicpf/src/mutex.h (.../mutex.h) (revision 28813ed68056ed023817951c1854bd73cc7d9e27) @@ -47,31 +47,11 @@ /**@{*/ /** \brief Standard constructor */ - mutex() - { -#ifdef _WIN32 - ::InitializeCriticalSection(&m_cs); -#else - pthread_mutexattr_t mta; - pthread_mutexattr_init(&mta); -//#warning Recursive mutexes are disabled; Make sure you use them the right way. - pthread_mutexattr_settype(&mta, PTHREAD_MUTEX_RECURSIVE_NP); - pthread_mutex_init(&m_mutex, &mta); + mutex(); - pthread_mutexattr_destroy(&mta); -#endif - }; - /** \brief Standard destructor */ - ~mutex() - { -#ifdef _WIN32 - ::DeleteCriticalSection(&m_cs); -#else - pthread_mutex_destroy(&m_mutex); -#endif - }; + ~mutex(); /**@}*/ // standard locking @@ -84,34 +64,18 @@ * \return True if succeeded or false if not. * \note The call under windows always return true. */ - bool lock() - { -#ifdef _WIN32 - ::EnterCriticalSection(&m_cs); - return true; -#else - return pthread_mutex_lock(&m_mutex) == 0; -#endif - }; + bool lock(); /** \brief Unlock access to some locked part of code * * Unlocks access to some code using the platform specific functions. * \return True if succeeded or false if not. * \note The call under windows always return true. */ - bool unlock() - { -#ifdef _WIN32 - ::LeaveCriticalSection(&m_cs); - return true; -#else - return pthread_mutex_unlock(&m_mutex) == 0; // return 0 on success -#endif - }; + bool unlock(); /**@}*/ -protected: +private: #ifdef _WIN32 /// Underlying windows locking structure CRITICAL_SECTION m_cs;