Commit 2d9a9802 authored by Dominik Charousset's avatar Dominik Charousset

moved assignment of last_worker into crit. section

parent 8d9c4afe
...@@ -241,21 +241,27 @@ class coordinator::shutdown_helper : public resumable { ...@@ -241,21 +241,27 @@ class coordinator::shutdown_helper : public resumable {
resumable::resume_result resume(detail::cs_thread*, execution_unit* ptr) { resumable::resume_result resume(detail::cs_thread*, execution_unit* ptr) {
CPPA_LOG_DEBUG("shutdown_helper::resume => shutdown worker"); CPPA_LOG_DEBUG("shutdown_helper::resume => shutdown worker");
last_worker = dynamic_cast<worker*>(ptr); auto wptr = dynamic_cast<worker*>(ptr);
CPPA_REQUIRE(last_worker != nullptr); CPPA_REQUIRE(wptr != nullptr);
std::unique_lock<std::mutex> guard(mtx); std::unique_lock<std::mutex> guard(mtx);
last_worker = wptr;
cv.notify_all(); cv.notify_all();
return resumable::shutdown_execution_unit; return resumable::shutdown_execution_unit;
} }
shutdown_helper() : last_worker(nullptr) { } shutdown_helper() : last_worker(nullptr) { }
~shutdown_helper();
std::mutex mtx; std::mutex mtx;
std::condition_variable cv; std::condition_variable cv;
worker* last_worker; worker* last_worker;
}; };
// get rid of weak-vtables warning by providing dtor out-of-line
coordinator::shutdown_helper::~shutdown_helper() { }
void coordinator::initialize() { void coordinator::initialize() {
// launch threads of utility actors // launch threads of utility actors
auto ptr = m_timer.get(); auto ptr = m_timer.get();
...@@ -457,9 +463,6 @@ void worker::run() { ...@@ -457,9 +463,6 @@ void worker::run() {
m_job_list.clear(); m_job_list.clear();
return; return;
} }
default: {
CPPA_CRITICAL("job->resume returned illegal result");
}
} }
job = nullptr; job = nullptr;
// give others the opportunity to steal from us // give others the opportunity to steal from us
......
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