Commit ddb7092e authored by Dominik Charousset's avatar Dominik Charousset

Give test_coordinator::run_once proper semantics

parent eba3a1da
......@@ -104,10 +104,8 @@ public:
/// Tries to execute a single event.
bool try_run_once();
/// Deprecated. Use `try_run_once()` instead.
inline bool run_once() CAF_DEPRECATED {
return try_run_once();
}
/// Executes a single event or fails if no event is available.
void run_once();
/// Executes events until the job queue is empty and no pending timeouts are
/// left. Returns the number of processed events.
......
......@@ -144,6 +144,12 @@ bool test_coordinator::try_run_once() {
return true;
}
void test_coordinator::run_once() {
if (jobs.empty())
CAF_RAISE_ERROR("No job to run available.");
try_run_once();
}
size_t test_coordinator::run(size_t max_count) {
size_t res = 0;
while (res < max_count && try_run_once())
......
......@@ -50,7 +50,7 @@ public:
// all executables on this node.
void exec_all() {
while (mpx.try_exec_runnable() || mpx.read_data()
|| this->sched.run_once()) {
|| this->sched.try_run_once()) {
// rince and repeat
}
}
......@@ -106,7 +106,7 @@ public:
CAF_MESSAGE("tell peer to accept the connection");
peer->mpx.accept_connection(peer->acc);
CAF_MESSAGE("run handshake between the two BASP broker instances");
while (sched.run_once() || peer->sched.run_once()
while (sched.try_run_once() || peer->sched.try_run_once()
|| mpx.try_exec_runnable() || peer->mpx.try_exec_runnable()
|| mpx.read_data() || peer->mpx.read_data()) {
// re-run until handhsake is fully completed
......@@ -168,7 +168,7 @@ public:
void exec_all() {
run_exhaustively([](planet_type* x) {
return x->mpx.try_exec_runnable() || x->mpx.read_data()
|| x->sched.run_once();
|| x->sched.try_run_once();
});
}
......
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