Commit c44db8a4 authored by Dominik Charousset's avatar Dominik Charousset

Avoid false positives in actor lifetime test

parent 2a3e00c3
...@@ -49,9 +49,13 @@ behavior tester(event_based_actor* self, const actor& aut) { ...@@ -49,9 +49,13 @@ behavior tester(event_based_actor* self, const actor& aut) {
CAF_CHECKPOINT(); CAF_CHECKPOINT();
return { return {
[self](const ExitMsgType&) { [self](const ExitMsgType&) {
// must not been destroyed here // must be still alive at this point
CAF_CHECK_EQUAL(s_testees.load(), 1); CAF_CHECK_EQUAL(s_testees.load(), 1);
self->send(self, atom("check")); // testee might be still running its cleanup code in
// another worker thread; by waiting some milliseconds, we make sure
// testee had enough time to return control to the scheduler
// which in turn destroys it by dropping the last remaining reference
self->delayed_send(self, std::chrono::milliseconds(30), atom("check"));
}, },
on(atom("check")) >> [self] { on(atom("check")) >> [self] {
// make sure dude's dtor has been called // make sure dude's dtor has been called
......
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