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
f67517fb
Commit
f67517fb
authored
Apr 10, 2013
by
Dominik Charousset
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
let stacked actors execute `become`
parent
da5cadba
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
17 additions
and
0 deletions
+17
-0
cppa/stacked.hpp
cppa/stacked.hpp
+2
-0
unit_testing/test_spawn.cpp
unit_testing/test_spawn.cpp
+15
-0
No files found.
cppa/stacked.hpp
View file @
f67517fb
...
@@ -117,6 +117,7 @@ class stacked : public Base {
...
@@ -117,6 +117,7 @@ class stacked : public Base {
void
become_impl
(
behavior
&&
bhvr
,
bool
discard_old
,
message_id
mid
)
{
void
become_impl
(
behavior
&&
bhvr
,
bool
discard_old
,
message_id
mid
)
{
auto
dthis
=
util
::
dptr
<
Subtype
>
(
this
);
auto
dthis
=
util
::
dptr
<
Subtype
>
(
this
);
bool
exec_afterwards
=
dthis
->
m_bhvr_stack
.
empty
();
if
(
bhvr
.
timeout
().
valid
())
{
if
(
bhvr
.
timeout
().
valid
())
{
dthis
->
reset_timeout
();
dthis
->
reset_timeout
();
dthis
->
request_timeout
(
bhvr
.
timeout
());
dthis
->
request_timeout
(
bhvr
.
timeout
());
...
@@ -125,6 +126,7 @@ class stacked : public Base {
...
@@ -125,6 +126,7 @@ class stacked : public Base {
dthis
->
m_bhvr_stack
.
pop_async_back
();
dthis
->
m_bhvr_stack
.
pop_async_back
();
}
}
dthis
->
m_bhvr_stack
.
push_back
(
std
::
move
(
bhvr
),
mid
);
dthis
->
m_bhvr_stack
.
push_back
(
std
::
move
(
bhvr
),
mid
);
if
(
exec_afterwards
)
dthis
->
exec_behavior_stack
();
}
}
};
};
...
...
unit_testing/test_spawn.cpp
View file @
f67517fb
...
@@ -693,8 +693,23 @@ int main() {
...
@@ -693,8 +693,23 @@ int main() {
);
);
// wait for termination of all spawned actors
// wait for termination of all spawned actors
await_all_others_done
();
await_all_others_done
();
// don't try this at home, kids
send
(
self
,
atom
(
"check"
));
try
{
become
(
on
(
atom
(
"check"
))
>>
[]
{
CPPA_CHECKPOINT
();
self
->
quit
();
}
);
CPPA_ERROR
(
"line "
<<
__LINE__
<<
" should be unreachable"
);
}
catch
(
actor_exited
&
)
{
CPPA_CHECKPOINT
();
}
CPPA_CHECK_EQUAL
(
flags
,
0x0F
);
CPPA_CHECK_EQUAL
(
flags
,
0x0F
);
// verify pong messages
// verify pong messages
CPPA_CHECK_EQUAL
(
pongs
(),
10
);
CPPA_CHECK_EQUAL
(
pongs
(),
10
);
shutdown
();
return
CPPA_TEST_RESULT
();
return
CPPA_TEST_RESULT
();
}
}
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