Core/LockGuard: Improve LockGuard
Former-commit-id: e9313d81c8cd9cb2cefef64a7c54713062ad9d6a
This commit is contained in:
@@ -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();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user