Commit 7d541296 authored by Dominik Charousset's avatar Dominik Charousset

Count nr. of `on_exit` calls in test_remote_actor

parent fd1e13b3
...@@ -20,6 +20,7 @@ using namespace caf; ...@@ -20,6 +20,7 @@ using namespace caf;
namespace { namespace {
atomic<long> s_destructors_called; atomic<long> s_destructors_called;
atomic<long> s_on_exit_called;
using string_pair = std::pair<std::string, std::string>; using string_pair = std::pair<std::string, std::string>;
...@@ -163,6 +164,10 @@ class client : public event_based_actor { ...@@ -163,6 +164,10 @@ class client : public event_based_actor {
return spawn_ping(); return spawn_ping();
} }
void on_exit() {
++s_on_exit_called;
}
~client() { ~client() {
++s_destructors_called; ++s_destructors_called;
} }
...@@ -243,6 +248,10 @@ class server : public event_based_actor { ...@@ -243,6 +248,10 @@ class server : public event_based_actor {
// nop // nop
} }
void on_exit() {
++s_on_exit_called;
}
~server() { ~server() {
++s_destructors_called; ++s_destructors_called;
} }
...@@ -421,5 +430,6 @@ int main(int argc, char** argv) { ...@@ -421,5 +430,6 @@ int main(int argc, char** argv) {
// we either spawn a server or a client, in both cases // we either spawn a server or a client, in both cases
// there must have been exactly one dtor called // there must have been exactly one dtor called
CAF_CHECK_EQUAL(s_destructors_called.load(), 1); CAF_CHECK_EQUAL(s_destructors_called.load(), 1);
CAF_CHECK_EQUAL(s_on_exit_called.load(), 1);
return CAF_TEST_RESULT(); return CAF_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