Core/LockGuard: Improve LockGuard

Former-commit-id: e9313d81c8cd9cb2cefef64a7c54713062ad9d6a
This commit is contained in:
Lynix
2016-04-16 18:38:52 +02:00
parent 1ec8c8c5e0
commit 104e393d65
3 changed files with 93 additions and 40 deletions

View File

@@ -1,37 +0,0 @@
// Copyright (C) 2015 Jérôme Leclercq
// This file is part of the "Nazara Engine - Core module"
// For conditions of distribution and use, see copyright notice in Config.hpp
#include <Nazara/Core/LockGuard.hpp>
#include <Nazara/Core/Mutex.hpp>
#include <Nazara/Core/Debug.hpp>
namespace Nz
{
/*!
* \ingroup core
* \class Nz::LockGuard
* \brief Core class that represents a mutex wrapper that provides a convenient RAII-style mechanism
*/
/*!
* \brief Constructs a LockGuard object with a mutex
*
* \param mutex Mutex to lock
*/
LockGuard::LockGuard(Mutex& mutex) :
m_mutex(mutex)
{
m_mutex.Lock();
}
/*!
* \brief Destructs a LockGuard object and unlocks the mutex
*/
LockGuard::~LockGuard()
{
m_mutex.Unlock();
}
}