From 96d4dc0be9c073478238da886f01c7fad1195ffa Mon Sep 17 00:00:00 2001 From: JDierkse Date: Fri, 26 Apr 2019 11:57:29 +0200 Subject: [PATCH] Fix Timer bug --- Util/Timer.cpp | 28 ---------------------------- Util/Timer.h | 8 +++----- 2 files changed, 3 insertions(+), 33 deletions(-) diff --git a/Util/Timer.cpp b/Util/Timer.cpp index 3228bf6..5d29bf6 100644 --- a/Util/Timer.cpp +++ b/Util/Timer.cpp @@ -1,5 +1,3 @@ -#include - #include #include "Util.h" #include "Timer.h" @@ -21,36 +19,11 @@ Timer::~Timer() Wait(); } -Timer::Timer(Timer&& other) : - m_run(static_cast(other.m_run)), - m_identifier(other.m_identifier), - m_thread(std::move(other.m_thread)) -{ -} - -Timer& Timer::operator=(Timer&& other) -{ - m_run = static_cast(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 lock(m_mutex); diff --git a/Util/Timer.h b/Util/Timer.h index dafabe9..8597b0d 100644 --- a/Util/Timer.h +++ b/Util/Timer.h @@ -4,6 +4,7 @@ #include #include #include +#include #include #include #include "Helpers.h" @@ -21,12 +22,7 @@ public: Timer(const Timer&) = delete; Timer& operator= (const Timer&) = delete; - Timer(Timer&& other); - Timer& operator= (Timer&& other); - bool operator==(const Timer& other) const; - bool operator==(const std::string& identifier) const; - bool operator==(bool running) const; public: std::string Identifier() const; @@ -102,6 +98,8 @@ private: std::thread m_thread; }; +typedef std::unique_ptr TimerPointer; + } // namespace Util } // namespace PresenceDetection