X-Git-Url: https://git.lizzy.rs/?a=blobdiff_plain;f=src%2Fthreading%2Fmutex_auto_lock.h;h=c809ff8f5856e0d15cce1c65f7f00edbf8dad7b3;hb=32ae4926578844eac1a7b72fcd4e26eb854eb7e5;hp=25caf7e140d9d7bfbbd89036c46cd0275d473678;hpb=e50c784e2ca55735fc360ae51534288c2ea59ca5;p=minetest.git diff --git a/src/threading/mutex_auto_lock.h b/src/threading/mutex_auto_lock.h index 25caf7e14..c809ff8f5 100644 --- a/src/threading/mutex_auto_lock.h +++ b/src/threading/mutex_auto_lock.h @@ -23,38 +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 - -#if __cplusplus >= 201103L - #include - using MutexAutoLock = std::unique_lock; - using RecursiveMutexAutoLock = std::unique_lock; -#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 +using MutexAutoLock = std::unique_lock; +using RecursiveMutexAutoLock = std::unique_lock;