reactor: auto-initialization hooks

This commit is contained in:
Roland Conybeare 2023-10-11 20:32:18 -04:00
commit daa09aff86
4 changed files with 41 additions and 21 deletions

View file

@ -4,23 +4,33 @@
*/
#include "Reactor.hpp"
#include "init_reactor.hpp"
#include "xo/subsys/Subsystem.hpp"
namespace xo {
namespace reactor {
void
Reactor::run_n(int32_t n)
{
if (n == -1) {
for (;;) {
this->run_one();
}
} else {
for (int32_t i=0; i<n; ++i) {
this->run_one();
}
}
} /*run_n*/
} /*namespace reactor*/
namespace reactor {
Reactor::Reactor() {
/* ensure reactor subsystem + deps initialized */
InitSubsys<S_reactor_tag>::require();
Subsystem::initialize_all();
}
void
Reactor::run_n(int32_t n)
{
if (n == -1) {
for (;;) {
this->run_one();
}
} else {
for (int32_t i=0; i<n; ++i) {
this->run_one();
}
}
} /*run_n*/
} /*namespace reactor*/
} /*namespace xo*/
/* end Reactor.cpp */