Fix Timer bug

This commit is contained in:
2019-04-26 11:57:29 +02:00
parent f96a45e3a2
commit 96d4dc0be9
2 changed files with 3 additions and 33 deletions
-28
View File
@@ -1,5 +1,3 @@
#include <iostream>
#include <chrono>
#include "Util.h"
#include "Timer.h"
@@ -21,36 +19,11 @@ Timer::~Timer()
Wait();
}
Timer::Timer(Timer&& other) :
m_run(static_cast<bool>(other.m_run)),
m_identifier(other.m_identifier),
m_thread(std::move(other.m_thread))
{
}
Timer& Timer::operator=(Timer&& other)
{
m_run = static_cast<bool>(other.m_run);
m_identifier = std::move(other.m_identifier);
m_thread = std::move(other.m_thread);
return *this;
}
bool Timer::operator==(const Timer& other) const
{
return m_identifier == other.Identifier();
}
bool Timer::operator==(const std::string& identifier) const
{
return m_identifier == identifier;
}
bool Timer::operator==(bool running) const
{
return IsRunning() == running;
}
std::string Timer::Identifier() const
{
return m_identifier;
@@ -63,7 +36,6 @@ void Timer::Stop()
void Timer::Abort()
{
std::cout << "Timer::Abort()" << std::endl;
m_run.store(false, std::memory_order_release);
{
std::unique_lock<std::mutex> lock(m_mutex);