Reactor.run_n() returns #events delivered

This commit is contained in:
Roland Conybeare 2023-10-12 01:31:20 -04:00
commit 9adfbb822d
3 changed files with 9 additions and 8 deletions

View file

@ -17,18 +17,22 @@ namespace xo {
Subsystem::initialize_all();
}
void
std::uint64_t
Reactor::run_n(int32_t n)
{
std::uint64_t retval = 0;
if (n == -1) {
for (;;) {
this->run_one();
retval += this->run_one();
}
} else {
for (int32_t i=0; i<n; ++i) {
this->run_one();
retval += this->run_one();
}
}
return retval;
} /*run_n*/
} /*namespace reactor*/
} /*namespace xo*/