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
b597510d
Commit
b597510d
authored
Nov 19, 2018
by
Dominik Charousset
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add missing getter for number of detached actors
parent
e9398439
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 @
b597510d
...
@@ -496,6 +496,11 @@ public:
...
@@ -496,6 +496,11 @@ public:
return
settings_
;
return
settings_
;
}
}
/// Returns the number of detached actors.
size_t
detached_actors
()
{
return
detached_
.
load
();
}
/// @cond PRIVATE
/// @cond PRIVATE
/// Increases running-detached-threads-count by one.
/// Increases running-detached-threads-count by one.
...
@@ -594,13 +599,13 @@ private:
...
@@ -594,13 +599,13 @@ private:
std
::
array
<
strong_actor_ptr
,
num_internal_actors
>
internal_actors_
;
std
::
array
<
strong_actor_ptr
,
num_internal_actors
>
internal_actors_
;
/// Counts the number of detached actors.
/// Counts the number of detached actors.
std
::
atomic
<
size_t
>
detached
;
std
::
atomic
<
size_t
>
detached
_
;
/// Guards `detached`.
/// Guards `detached`.
mutable
std
::
mutex
detached_mtx
;
mutable
std
::
mutex
detached_mtx
_
;
/// Allows waiting on specific values for `detached`.
/// 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.
/// The system-wide, user-provided configuration.
actor_system_config
&
cfg_
;
actor_system_config
&
cfg_
;
...
...
libcaf_core/src/actor_system.cpp
View file @
b597510d
...
@@ -226,7 +226,7 @@ actor_system::actor_system(actor_system_config& cfg)
...
@@ -226,7 +226,7 @@ actor_system::actor_system(actor_system_config& cfg)
groups_
(
*
this
),
groups_
(
*
this
),
dummy_execution_unit_
(
this
),
dummy_execution_unit_
(
this
),
await_actors_before_shutdown_
(
true
),
await_actors_before_shutdown_
(
true
),
detached
(
0
),
detached
_
(
0
),
cfg_
(
cfg
),
cfg_
(
cfg
),
logger_dtor_done_
(
false
)
{
logger_dtor_done_
(
false
)
{
CAF_SET_LOGGER_SYS
(
this
);
CAF_SET_LOGGER_SYS
(
this
);
...
@@ -434,19 +434,19 @@ actor_clock& actor_system::clock() noexcept {
...
@@ -434,19 +434,19 @@ actor_clock& actor_system::clock() noexcept {
}
}
void
actor_system
::
inc_detached_threads
()
{
void
actor_system
::
inc_detached_threads
()
{
++
detached
;
++
detached
_
;
}
}
void
actor_system
::
dec_detached_threads
()
{
void
actor_system
::
dec_detached_threads
()
{
std
::
unique_lock
<
std
::
mutex
>
guard
{
detached_mtx
};
std
::
unique_lock
<
std
::
mutex
>
guard
{
detached_mtx
_
};
if
(
--
detached
==
0
)
if
(
--
detached
_
==
0
)
detached_cv
.
notify_all
();
detached_cv
_
.
notify_all
();
}
}
void
actor_system
::
await_detached_threads
()
{
void
actor_system
::
await_detached_threads
()
{
std
::
unique_lock
<
std
::
mutex
>
guard
{
detached_mtx
};
std
::
unique_lock
<
std
::
mutex
>
guard
{
detached_mtx
_
};
while
(
detached
!=
0
)
while
(
detached
_
!=
0
)
detached_cv
.
wait
(
guard
);
detached_cv
_
.
wait
(
guard
);
}
}
void
actor_system
::
thread_started
()
{
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