diff options
Diffstat (limited to 'src/threading/mutex_auto_lock.h')
-rw-r--r-- | src/threading/mutex_auto_lock.h | 40 |
1 files changed, 4 insertions, 36 deletions
diff --git a/src/threading/mutex_auto_lock.h b/src/threading/mutex_auto_lock.h index d79c68a93..c809ff8f5 100644 --- a/src/threading/mutex_auto_lock.h +++ b/src/threading/mutex_auto_lock.h @@ -23,40 +23,8 @@ FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -#ifndef THREADING_MUTEX_AUTO_LOCK_H -#define THREADING_MUTEX_AUTO_LOCK_H - -#include "threads.h" - -#if USE_CPP11_MUTEX - #include <mutex> - using MutexAutoLock = std::unique_lock<std::mutex>; - using RecursiveMutexAutoLock = std::unique_lock<std::recursive_mutex>; -#else - -#include "threading/mutex.h" - - -class MutexAutoLock -{ -public: - MutexAutoLock(Mutex &m) : mutex(m) { mutex.lock(); } - ~MutexAutoLock() { mutex.unlock(); } - -private: - Mutex &mutex; -}; - -class RecursiveMutexAutoLock -{ -public: - RecursiveMutexAutoLock(RecursiveMutex &m) : mutex(m) { mutex.lock(); } - ~RecursiveMutexAutoLock() { mutex.unlock(); } - -private: - RecursiveMutex &mutex; -}; -#endif - -#endif +#pragma once +#include <mutex> +using MutexAutoLock = std::unique_lock<std::mutex>; +using RecursiveMutexAutoLock = std::unique_lock<std::recursive_mutex>; |