Commit 65fbdbbe authored by Joseph Noir's avatar Joseph Noir

Fix namespaces

parent 00cbb5e7
...@@ -23,6 +23,7 @@ ...@@ -23,6 +23,7 @@
#include <chrono> #include <chrono>
#include <cstdio> #include <cstdio>
#include <algorithm>
#ifdef __RIOTBUILD_FLAG #ifdef __RIOTBUILD_FLAG
......
...@@ -70,7 +70,7 @@ class lock_guard { ...@@ -70,7 +70,7 @@ class lock_guard {
public: public:
using mutex_type = Mutex; using mutex_type = Mutex;
inline explicit lock_guard(mutex_type& mtx) : m_mtx{mtx} { m_mtx.lock(); } inline explicit lock_guard(mutex_type& mtx) : m_mtx(mtx) { m_mtx.lock(); }
inline lock_guard(mutex_type& mtx, adopt_lock_t) : m_mtx{mtx} {} inline lock_guard(mutex_type& mtx, adopt_lock_t) : m_mtx{mtx} {}
inline ~lock_guard() { m_mtx.unlock(); } inline ~lock_guard() { m_mtx.unlock(); }
......
...@@ -88,7 +88,7 @@ class coordinator : public abstract_coordinator { ...@@ -88,7 +88,7 @@ class coordinator : public abstract_coordinator {
resumable::resume_result resume(execution_unit* ptr, size_t) override { resumable::resume_result resume(execution_unit* ptr, size_t) override {
CAF_LOG_DEBUG("shutdown_helper::resume => shutdown worker"); CAF_LOG_DEBUG("shutdown_helper::resume => shutdown worker");
CAF_ASSERT(ptr != nullptr); CAF_ASSERT(ptr != nullptr);
std::unique_lock<std::mutex> guard(mtx); nique_lock<mutex> guard(mtx);
last_worker = ptr; last_worker = ptr;
cv.notify_all(); cv.notify_all();
return resumable::shutdown_execution_unit; return resumable::shutdown_execution_unit;
...@@ -96,8 +96,8 @@ class coordinator : public abstract_coordinator { ...@@ -96,8 +96,8 @@ class coordinator : public abstract_coordinator {
shutdown_helper() : last_worker(nullptr) { shutdown_helper() : last_worker(nullptr) {
// nop // nop
} }
std::mutex mtx; mutex mtx;
std::condition_variable cv; condition_variable cv;
execution_unit* last_worker; execution_unit* last_worker;
}; };
// use a set to keep track of remaining workers // use a set to keep track of remaining workers
...@@ -113,7 +113,7 @@ class coordinator : public abstract_coordinator { ...@@ -113,7 +113,7 @@ class coordinator : public abstract_coordinator {
// since jobs can be stolen, we cannot assume that we have // since jobs can be stolen, we cannot assume that we have
// actually shut down the worker we've enqueued sh to // actually shut down the worker we've enqueued sh to
{ // lifetime scope of guard { // lifetime scope of guard
std::unique_lock<std::mutex> guard(sh.mtx); unique_lock<mutex> guard(sh.mtx);
sh.cv.wait(guard, [&] { return sh.last_worker != nullptr; }); sh.cv.wait(guard, [&] { return sh.last_worker != nullptr; });
} }
alive_workers.erase(static_cast<worker_type*>(sh.last_worker)); alive_workers.erase(static_cast<worker_type*>(sh.last_worker));
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment