Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
A
Actor Framework
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
cpp-libs
Actor Framework
Commits
1a1fedfd
Commit
1a1fedfd
authored
Mar 10, 2018
by
Dominik Charousset
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use atomic<> instead mis-using volatile
parent
afbdb170
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
4 deletions
+8
-4
libcaf_core/caf/detail/private_thread.hpp
libcaf_core/caf/detail/private_thread.hpp
+4
-3
libcaf_core/src/private_thread.cpp
libcaf_core/src/private_thread.cpp
+4
-1
No files found.
libcaf_core/caf/detail/private_thread.hpp
View file @
1a1fedfd
...
...
@@ -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_
;
};
...
...
libcaf_core/src/private_thread.cpp
View file @
1a1fedfd
...
...
@@ -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
(
""
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment