From 06b78f1b80d6dfc3937b797e508b0e7d2b86c89a Mon Sep 17 00:00:00 2001 From: Sebastian Messmer Date: Thu, 12 Nov 2015 13:07:59 -0800 Subject: [PATCH] Adapt to new cpputils --- implementations/caching/cache/PeriodicTask.cpp | 3 ++- implementations/caching/cache/PeriodicTask.h | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/implementations/caching/cache/PeriodicTask.cpp b/implementations/caching/cache/PeriodicTask.cpp index a8e8abfc..14af6d5e 100644 --- a/implementations/caching/cache/PeriodicTask.cpp +++ b/implementations/caching/cache/PeriodicTask.cpp @@ -15,11 +15,12 @@ PeriodicTask::PeriodicTask(function task, double intervalSec) : _thread.start(); } -void PeriodicTask::_loopIteration() { +bool PeriodicTask::_loopIteration() { //Has to be boost::this_thread::sleep_for and not std::this_thread::sleep_for, because it has to be interruptible. //LoopThread will interrupt this method if it has to be restarted. boost::this_thread::sleep_for(_interval); _task(); + return true; // Run another iteration (don't terminate thread) } } diff --git a/implementations/caching/cache/PeriodicTask.h b/implementations/caching/cache/PeriodicTask.h index 751397ff..59eeb172 100644 --- a/implementations/caching/cache/PeriodicTask.h +++ b/implementations/caching/cache/PeriodicTask.h @@ -3,7 +3,7 @@ #define MESSMER_BLOCKSTORE_IMPLEMENTATIONS_CACHING_CACHE_PERIODICTASK_H_ #include -#include +#include #include namespace blockstore { @@ -14,7 +14,7 @@ public: PeriodicTask(std::function task, double intervalSec); private: - void _loopIteration(); + bool _loopIteration(); std::function _task; boost::chrono::nanoseconds _interval;