general timer: nanosm::Timer : nanosm::EventLoop::Pollable bool Set(... duration, ... callback); // OnReady() will just call the timer callback proesses: nanosm::Process : nanosm::EventLoop::Pollable void Kill(); bool Spawn(... exitCallback); static std::shared_ptr SpawnCmdLine(); nanosm::RestartingProcess final : Process // spawn is shadowed by a version that exits callback to set timerfd-backed timer which on expiry/callback will be cancelled // then spawn the process again (which will make it have a valid pidfd again etc etc std::shared_ptr timer; program mainn flow: main() parse config (fail if it's bad) create state (nanosm::NanoSm), from parsed config create event loop post callback into event loop to run state run event loop nanosm::NanoSm::Run() spawn wm (if this fails give up and exit early) for each app (in toml order): spawn app return (the event loop wil persist and keep everything alive until it needs to shutdown)