Core: Made Mutex and ConditionVariable moveable

Former-commit-id: 891fbb35d050f3df572cbbecd0191b75f556e59d
This commit is contained in:
Lynix
2016-03-01 13:59:17 +01:00
parent 790275da8f
commit f9a95ce054
6 changed files with 90 additions and 4 deletions

View File

@@ -19,7 +19,7 @@ namespace Nz
public:
ConditionVariable();
ConditionVariable(const ConditionVariable&) = delete;
ConditionVariable(ConditionVariable&&) = delete; ///TODO
inline ConditionVariable(ConditionVariable&& condition) noexcept;
~ConditionVariable();
void Signal();
@@ -29,11 +29,13 @@ namespace Nz
bool Wait(Mutex* mutex, UInt32 timeout);
ConditionVariable& operator=(const ConditionVariable&) = delete;
ConditionVariable& operator=(ConditionVariable&&) = delete; ///TODO
inline ConditionVariable& operator=(ConditionVariable&& condition) noexcept;
private:
ConditionVariableImpl* m_impl;
};
}
#include <Nazara/Core/ConditionVariable.inl>
#endif // NAZARA_CONDITIONVARIABLE_HPP

View File

@@ -0,0 +1,25 @@
// 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/ConditionVariable.hpp>
#include <Nazara/Core/Error.hpp>
#include <Nazara/Core/Debug.hpp>
namespace Nz
{
/*!
* \class Nz::ConditionVariable
*/
/*!
* \brief Constructs a ConditionVariable object by moving another one
*/
inline ConditionVariable::ConditionVariable(ConditionVariable&& condition) noexcept :
m_impl(condition.m_impl)
{
condition.m_impl = nullptr;
}
}
#include <Nazara/Core/DebugOff.hpp>

View File

@@ -20,7 +20,7 @@ namespace Nz
public:
Mutex();
Mutex(const Mutex&) = delete;
Mutex(Mutex&&) = delete; ///TODO
inline Mutex(Mutex&& mutex) noexcept;
~Mutex();
void Lock();
@@ -28,11 +28,13 @@ namespace Nz
void Unlock();
Mutex& operator=(const Mutex&) = delete;
Mutex& operator=(Mutex&&) = delete; ///TODO
Mutex& operator=(Mutex&& mutex) noexcept;
private:
MutexImpl* m_impl;
};
}
#include <Nazara/Core/Mutex.inl>
#endif // NAZARA_MUTEX_HPP

View File

@@ -0,0 +1,25 @@
// 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/Mutex.hpp>
#include <Nazara/Core/Error.hpp>
#include <Nazara/Core/Debug.hpp>
namespace Nz
{
/*!
* \class Nz::Mutex
*/
/*!
* \brief Constructs a Mutex object by moving another one
*/
inline Mutex::Mutex(Mutex&& mutex) noexcept :
m_impl(mutex.m_impl)
{
mutex.m_impl = nullptr;
}
}
#include <Nazara/Core/DebugOff.hpp>