Core: Add MovablePtr class
This commit is contained in:
@@ -6,6 +6,7 @@
|
||||
#include <Nazara/Core/Config.hpp>
|
||||
#include <Nazara/Core/Error.hpp>
|
||||
#include <Nazara/Core/HardwareInfo.hpp>
|
||||
#include <Nazara/Core/MovablePtr.hpp>
|
||||
#include <ostream>
|
||||
#include <stdexcept>
|
||||
|
||||
@@ -36,18 +37,6 @@ namespace Nz
|
||||
{
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Constructs a Thread<T> object by move semantic
|
||||
*
|
||||
* \param other Thread to move into this
|
||||
*/
|
||||
|
||||
Thread::Thread(Thread&& other) noexcept :
|
||||
m_impl(other.m_impl)
|
||||
{
|
||||
other.m_impl = nullptr;
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Waits that the thread ends and then destroys this
|
||||
*/
|
||||
@@ -136,30 +125,6 @@ namespace Nz
|
||||
m_impl->SetName(name);
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Moves the other thread into this
|
||||
* \return A reference to this
|
||||
*
|
||||
* \param thread Thread to move in this
|
||||
*
|
||||
* \remark Produce a NazaraError if no functor was assigned and NAZARA_CORE_SAFE is defined
|
||||
* \remark And call std::terminate if no functor was assigned and NAZARA_CORE_SAFE is defined
|
||||
*/
|
||||
|
||||
Thread& Thread::operator=(Thread&& thread)
|
||||
{
|
||||
#if NAZARA_CORE_SAFE
|
||||
if (m_impl)
|
||||
{
|
||||
NazaraError("This thread cannot be joined");
|
||||
std::terminate();
|
||||
}
|
||||
#endif
|
||||
|
||||
std::swap(m_impl, thread.m_impl);
|
||||
return *this;
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Gets the number of simulatenous threads that can run on the same cpu
|
||||
* \return The number of simulatenous threads
|
||||
|
||||
Reference in New Issue
Block a user