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
e705dd69
Commit
e705dd69
authored
Sep 01, 2020
by
Dominik Charousset
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #1138
parents
20168887
606bbecf
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
12 additions
and
15 deletions
+12
-15
libcaf_core/caf/actor_registry.hpp
libcaf_core/caf/actor_registry.hpp
+4
-4
libcaf_core/src/abstract_actor.cpp
libcaf_core/src/abstract_actor.cpp
+4
-2
libcaf_core/src/actor_registry.cpp
libcaf_core/src/actor_registry.cpp
+4
-9
No files found.
libcaf_core/caf/actor_registry.hpp
View file @
e705dd69
...
@@ -65,11 +65,11 @@ public:
...
@@ -65,11 +65,11 @@ public:
/// leaving `reason` for future reference.
/// leaving `reason` for future reference.
void
erase
(
actor_id
key
);
void
erase
(
actor_id
key
);
/// Increases running-actors-count by one.
/// Increases running-actors-count by one.
Returns the increased count.
void
inc_running
();
size_t
inc_running
();
/// Decreases running-actors-count by one.
/// Decreases running-actors-count by one.
Returns the decreased count.
void
dec_running
();
size_t
dec_running
();
/// Returns the number of currently running actors.
/// Returns the number of currently running actors.
size_t
running
()
const
;
size_t
running
()
const
;
...
...
libcaf_core/src/abstract_actor.cpp
View file @
e705dd69
...
@@ -95,14 +95,16 @@ void abstract_actor::register_at_system() {
...
@@ -95,14 +95,16 @@ void abstract_actor::register_at_system() {
if
(
getf
(
is_registered_flag
))
if
(
getf
(
is_registered_flag
))
return
;
return
;
setf
(
is_registered_flag
);
setf
(
is_registered_flag
);
home_system
().
registry
().
inc_running
();
[[
maybe_unused
]]
auto
count
=
home_system
().
registry
().
inc_running
();
CAF_LOG_DEBUG
(
"actor "
<<
id
()
<<
" increased running count to "
<<
count
);
}
}
void
abstract_actor
::
unregister_from_system
()
{
void
abstract_actor
::
unregister_from_system
()
{
if
(
!
getf
(
is_registered_flag
))
if
(
!
getf
(
is_registered_flag
))
return
;
return
;
unsetf
(
is_registered_flag
);
unsetf
(
is_registered_flag
);
home_system
().
registry
().
dec_running
();
[[
maybe_unused
]]
auto
count
=
home_system
().
registry
().
dec_running
();
CAF_LOG_DEBUG
(
"actor "
<<
id
()
<<
" decreased running count to "
<<
count
);
}
}
}
// namespace caf
}
// namespace caf
libcaf_core/src/actor_registry.cpp
View file @
e705dd69
...
@@ -94,26 +94,21 @@ void actor_registry::erase(actor_id key) {
...
@@ -94,26 +94,21 @@ void actor_registry::erase(actor_id key) {
}
}
}
}
void
actor_registry
::
inc_running
()
{
size_t
actor_registry
::
inc_running
()
{
# if CAF_LOG_LEVEL >= CAF_LOG_LEVEL_DEBUG
return
++*
system_
.
base_metrics
().
running_actors
;
auto
value
=
++*
system_
.
base_metrics
().
running_actors
;
CAF_LOG_DEBUG
(
CAF_ARG
(
value
));
# else
system_
.
base_metrics
().
running_actors
->
inc
();
# endif
}
}
size_t
actor_registry
::
running
()
const
{
size_t
actor_registry
::
running
()
const
{
return
static_cast
<
size_t
>
(
system_
.
base_metrics
().
running_actors
->
value
());
return
static_cast
<
size_t
>
(
system_
.
base_metrics
().
running_actors
->
value
());
}
}
void
actor_registry
::
dec_running
()
{
size_t
actor_registry
::
dec_running
()
{
size_t
new_val
=
--*
system_
.
base_metrics
().
running_actors
;
size_t
new_val
=
--*
system_
.
base_metrics
().
running_actors
;
if
(
new_val
<=
1
)
{
if
(
new_val
<=
1
)
{
std
::
unique_lock
<
std
::
mutex
>
guard
(
running_mtx_
);
std
::
unique_lock
<
std
::
mutex
>
guard
(
running_mtx_
);
running_cv_
.
notify_all
();
running_cv_
.
notify_all
();
}
}
CAF_LOG_DEBUG
(
CAF_ARG
(
new_val
))
;
return
new_val
;
}
}
void
actor_registry
::
await_running_count_equal
(
size_t
expected
)
const
{
void
actor_registry
::
await_running_count_equal
(
size_t
expected
)
const
{
...
...
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