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
a271c786
Commit
a271c786
authored
Sep 10, 2018
by
Dominik Charousset
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Rename has_behavior to alive
parent
ea7b8e3e
Changes
6
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
24 additions
and
18 deletions
+24
-18
libcaf_core/caf/scheduled_actor.hpp
libcaf_core/caf/scheduled_actor.hpp
+17
-9
libcaf_core/caf/typed_event_based_actor.hpp
libcaf_core/caf/typed_event_based_actor.hpp
+1
-1
libcaf_core/src/event_based_actor.cpp
libcaf_core/src/event_based_actor.cpp
+1
-1
libcaf_core/src/scheduled_actor.cpp
libcaf_core/src/scheduled_actor.cpp
+3
-5
libcaf_io/caf/io/typed_broker.hpp
libcaf_io/caf/io/typed_broker.hpp
+1
-1
libcaf_io/src/broker.cpp
libcaf_io/src/broker.cpp
+1
-1
No files found.
libcaf_core/caf/scheduled_actor.hpp
View file @
a271c786
...
...
@@ -690,14 +690,9 @@ public:
// -- behavior management ----------------------------------------------------
/// Returns whether `true` if the behavior stack is not empty or
/// if outstanding responses exist, `false` otherwise.
inline
bool
has_behavior
()
const
{
return
!
bhvr_stack_
.
empty
()
||
!
awaited_responses_
.
empty
()
||
!
multiplexed_responses_
.
empty
()
||
!
stream_managers_
.
empty
()
||
!
pending_stream_managers_
.
empty
();
/// Returns whether `true` if the behavior stack is not empty.
inline
bool
has_behavior
()
const
noexcept
{
return
!
bhvr_stack_
.
empty
();
}
inline
behavior
&
current_behavior
()
{
...
...
@@ -871,6 +866,19 @@ public:
/// this function again.
actor_clock
::
time_point
advance_streams
(
actor_clock
::
time_point
now
);
// -- properties -------------------------------------------------------------
/// Returns `true` if the actor has a behavior, awaits responses, or
/// participates in streams.
/// @private
inline
bool
alive
()
const
noexcept
{
return
!
bhvr_stack_
.
empty
()
||
!
awaited_responses_
.
empty
()
||
!
multiplexed_responses_
.
empty
()
||
!
stream_managers_
.
empty
()
||
!
pending_stream_managers_
.
empty
();
}
/// @endcond
protected:
...
...
libcaf_core/caf/typed_event_based_actor.hpp
View file @
a271c786
...
...
@@ -73,7 +73,7 @@ public:
this
->
setf
(
abstract_actor
::
is_initialized_flag
);
auto
bhvr
=
make_behavior
();
CAF_LOG_DEBUG_IF
(
!
bhvr
,
"make_behavior() did not return a behavior:"
<<
CAF_ARG
(
this
->
has_behavior
()));
<<
CAF_ARG2
(
"alive"
,
this
->
alive
()));
if
(
bhvr
)
{
// make_behavior() did return a behavior instead of using become()
CAF_LOG_DEBUG
(
"make_behavior() did return a valid behavior"
);
...
...
libcaf_core/src/event_based_actor.cpp
View file @
a271c786
...
...
@@ -38,7 +38,7 @@ void event_based_actor::initialize() {
setf
(
is_initialized_flag
);
auto
bhvr
=
make_behavior
();
CAF_LOG_DEBUG_IF
(
!
bhvr
,
"make_behavior() did not return a behavior:"
<<
CAF_ARG
(
has_behavior
()));
<<
CAF_ARG
2
(
"alive"
,
alive
()));
if
(
bhvr
)
{
// make_behavior() did return a behavior instead of using become()
CAF_LOG_DEBUG
(
"make_behavior() did return a valid behavior"
);
...
...
libcaf_core/src/scheduled_actor.cpp
View file @
a271c786
...
...
@@ -680,10 +680,8 @@ bool scheduled_actor::activate(execution_unit* ctx) {
CAF_ASSERT
(
ctx
!=
nullptr
);
CAF_ASSERT
(
!
getf
(
is_blocking_flag
));
context
(
ctx
);
if
(
getf
(
is_initialized_flag
)
&&
(
!
has_behavior
()
||
getf
(
is_terminated_flag
)))
{
CAF_LOG_DEBUG_IF
(
!
has_behavior
(),
"resume called on an actor without behavior"
);
if
(
getf
(
is_initialized_flag
)
&&
(
!
alive
()
||
getf
(
is_terminated_flag
)))
{
CAF_LOG_DEBUG_IF
(
!
alive
(),
"resume called on an actor without behavior"
);
CAF_LOG_DEBUG_IF
(
getf
(
is_terminated_flag
),
"resume called on a terminated actor"
);
return
false
;
...
...
@@ -781,7 +779,7 @@ bool scheduled_actor::finalize() {
return
true
;
// An actor is considered alive as long as it has a behavior and didn't set
// the terminated flag.
if
(
has_behavior
()
&&
!
getf
(
is_terminated_flag
))
if
(
alive
()
&&
!
getf
(
is_terminated_flag
))
return
false
;
CAF_LOG_DEBUG
(
"actor either has no behavior or has set an exit reason"
);
on_exit
();
...
...
libcaf_io/caf/io/typed_broker.hpp
View file @
a271c786
...
...
@@ -96,7 +96,7 @@ public:
this
->
init_broker
();
auto
bhvr
=
make_behavior
();
CAF_LOG_DEBUG_IF
(
!
bhvr
,
"make_behavior() did not return a behavior:"
<<
CAF_ARG
(
this
->
has_behavior
()));
<<
CAF_ARG2
(
"alive"
,
this
->
alive
()));
if
(
bhvr
)
{
// make_behavior() did return a behavior instead of using become()
CAF_LOG_DEBUG
(
"make_behavior() did return a valid behavior"
);
...
...
libcaf_io/src/broker.cpp
View file @
a271c786
...
...
@@ -37,7 +37,7 @@ void broker::initialize() {
init_broker
();
auto
bhvr
=
make_behavior
();
CAF_LOG_DEBUG_IF
(
!
bhvr
,
"make_behavior() did not return a behavior:"
<<
CAF_ARG
(
has_behavior
()));
<<
CAF_ARG2
(
"alive"
,
alive
()));
if
(
bhvr
)
{
// make_behavior() did return a behavior instead of using become()
CAF_LOG_DEBUG
(
"make_behavior() did return a valid behavior"
);
...
...
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