Note: Eio_main.run
should only be run once in your application. Calling it in a recursive function isn’t likely to work.
I’m not quite sure what you’re trying to do, but for a repeating timer that can be paused, something like this should work:
let cond = Eio.Condition.create () in
let unpaused = ref (Promise.create_resolved ()) in
...
while true do
Promise.await !unpaused;
Eio.Condition.broadcast cond;
Eio.Time.Timeout.sleep delay
done
To pause, set unpaused
to a new promise and resolve it to unpause.