Commit 1a1fedfd authored by Dominik Charousset's avatar Dominik Charousset

Use atomic<> instead mis-using volatile

parent afbdb170
......@@ -19,6 +19,7 @@
#ifndef CAF_DETAIL_PRIVATE_THREAD_HPP
#define CAF_DETAIL_PRIVATE_THREAD_HPP
#include <atomic>
#include <mutex>
#include <condition_variable>
......@@ -56,9 +57,9 @@ public:
private:
std::mutex mtx_;
std::condition_variable cv_;
volatile bool self_destroyed_;
volatile scheduled_actor* self_;
volatile worker_state state_;
std::atomic<bool> self_destroyed_;
std::atomic<scheduled_actor*> self_;
std::atomic<worker_state> state_;
actor_system& system_;
};
......
......@@ -18,6 +18,8 @@
#include "caf/detail/private_thread.hpp"
#include "caf/config.hpp"
#include "caf/logger.hpp"
#include "caf/scheduled_actor.hpp"
namespace caf {
......@@ -33,7 +35,8 @@ private_thread::private_thread(scheduled_actor* self)
}
void private_thread::run() {
auto job = const_cast<scheduled_actor*>(self_);
auto job = self_.load();
CAF_ASSERT(job != nullptr);
CAF_SET_LOGGER_SYS(&job->system());
CAF_PUSH_AID(job->id());
CAF_LOG_TRACE("");
......
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