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
3d927140
Commit
3d927140
authored
Nov 19, 2018
by
Dominik Charousset
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'topic/detached-actors'
parents
c57d18c2
b597510d
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
16 additions
and
11 deletions
+16
-11
libcaf_core/caf/actor_system.hpp
libcaf_core/caf/actor_system.hpp
+8
-3
libcaf_core/src/actor_system.cpp
libcaf_core/src/actor_system.cpp
+8
-8
No files found.
libcaf_core/caf/actor_system.hpp
View file @
3d927140
...
...
@@ -496,6 +496,11 @@ public:
return
settings_
;
}
/// Returns the number of detached actors.
size_t
detached_actors
()
{
return
detached_
.
load
();
}
/// @cond PRIVATE
/// Increases running-detached-threads-count by one.
...
...
@@ -594,13 +599,13 @@ private:
std
::
array
<
strong_actor_ptr
,
num_internal_actors
>
internal_actors_
;
/// Counts the number of detached actors.
std
::
atomic
<
size_t
>
detached
;
std
::
atomic
<
size_t
>
detached
_
;
/// Guards `detached`.
mutable
std
::
mutex
detached_mtx
;
mutable
std
::
mutex
detached_mtx
_
;
/// Allows waiting on specific values for `detached`.
mutable
std
::
condition_variable
detached_cv
;
mutable
std
::
condition_variable
detached_cv
_
;
/// The system-wide, user-provided configuration.
actor_system_config
&
cfg_
;
...
...
libcaf_core/src/actor_system.cpp
View file @
3d927140
...
...
@@ -226,7 +226,7 @@ actor_system::actor_system(actor_system_config& cfg)
groups_
(
*
this
),
dummy_execution_unit_
(
this
),
await_actors_before_shutdown_
(
true
),
detached
(
0
),
detached
_
(
0
),
cfg_
(
cfg
),
logger_dtor_done_
(
false
)
{
CAF_SET_LOGGER_SYS
(
this
);
...
...
@@ -434,19 +434,19 @@ actor_clock& actor_system::clock() noexcept {
}
void
actor_system
::
inc_detached_threads
()
{
++
detached
;
++
detached
_
;
}
void
actor_system
::
dec_detached_threads
()
{
std
::
unique_lock
<
std
::
mutex
>
guard
{
detached_mtx
};
if
(
--
detached
==
0
)
detached_cv
.
notify_all
();
std
::
unique_lock
<
std
::
mutex
>
guard
{
detached_mtx
_
};
if
(
--
detached
_
==
0
)
detached_cv
_
.
notify_all
();
}
void
actor_system
::
await_detached_threads
()
{
std
::
unique_lock
<
std
::
mutex
>
guard
{
detached_mtx
};
while
(
detached
!=
0
)
detached_cv
.
wait
(
guard
);
std
::
unique_lock
<
std
::
mutex
>
guard
{
detached_mtx
_
};
while
(
detached
_
!=
0
)
detached_cv
_
.
wait
(
guard
);
}
void
actor_system
::
thread_started
()
{
...
...
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