Commit f67517fb authored by Dominik Charousset's avatar Dominik Charousset

let stacked actors execute `become`

parent da5cadba
......@@ -117,6 +117,7 @@ class stacked : public Base {
void become_impl(behavior&& bhvr, bool discard_old, message_id mid) {
auto dthis = util::dptr<Subtype>(this);
bool exec_afterwards = dthis->m_bhvr_stack.empty();
if (bhvr.timeout().valid()) {
dthis->reset_timeout();
dthis->request_timeout(bhvr.timeout());
......@@ -125,6 +126,7 @@ class stacked : public Base {
dthis->m_bhvr_stack.pop_async_back();
}
dthis->m_bhvr_stack.push_back(std::move(bhvr), mid);
if (exec_afterwards) dthis->exec_behavior_stack();
}
};
......
......@@ -693,8 +693,23 @@ int main() {
);
// wait for termination of all spawned actors
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);
// verify pong messages
CPPA_CHECK_EQUAL(pongs(), 10);
shutdown();
return CPPA_TEST_RESULT();
}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment