|
@@ -24,6 +24,7 @@ public:
|
|
|
|
|
|
|
|
bool operator==(const Timer& other) const;
|
|
bool operator==(const Timer& other) const;
|
|
|
bool operator==(const std::string& identifier) const;
|
|
bool operator==(const std::string& identifier) const;
|
|
|
|
|
+ bool operator==(bool running) const;
|
|
|
|
|
|
|
|
public:
|
|
public:
|
|
|
std::string Identifier() const;
|
|
std::string Identifier() const;
|
|
@@ -66,7 +67,7 @@ private:
|
|
|
if (m_run.load(std::memory_order_acquire))
|
|
if (m_run.load(std::memory_order_acquire))
|
|
|
Stop();
|
|
Stop();
|
|
|
|
|
|
|
|
- m_thread = std::thread([this, interval, function, &arguments...]()
|
|
|
|
|
|
|
+ m_thread = std::thread([this, type, interval, function, &arguments...]()
|
|
|
{
|
|
{
|
|
|
auto argumentsCopy = std::make_tuple(std::forward<Arguments>(arguments)...);
|
|
auto argumentsCopy = std::make_tuple(std::forward<Arguments>(arguments)...);
|
|
|
m_run.store(true, std::memory_order_release);
|
|
m_run.store(true, std::memory_order_release);
|
|
@@ -75,7 +76,7 @@ private:
|
|
|
{
|
|
{
|
|
|
std::this_thread::sleep_for(std::chrono::milliseconds(interval));
|
|
std::this_thread::sleep_for(std::chrono::milliseconds(interval));
|
|
|
Helpers::execute(function, argumentsCopy);
|
|
Helpers::execute(function, argumentsCopy);
|
|
|
- if (TimerType::Single)
|
|
|
|
|
|
|
+ if (type == TimerType::Single)
|
|
|
m_run.store(false, std::memory_order_release);
|
|
m_run.store(false, std::memory_order_release);
|
|
|
}
|
|
}
|
|
|
});
|
|
});
|