Closed polytypic closed 2 months ago
Having a Bundle or Flock terminate fibers on return is often convenient. In particular, this is convenient for setting up a bundle for daemon fibers:
Bundle
Flock
Bundle.join_after ~on_return:`Terminate @@ fun daemons -> Bundle.fork daemons (fun () -> (* ... *)) (* ... *)
Another alternative (one of many) is to fork as a promise and use a finalizer:
let@ _daemon = finally Promise.terminate @@ fun () -> Flock.fork_as_promise @@ fun () -> (* ... *) in (* ... *)
Having a
Bundle
orFlock
terminate fibers on return is often convenient. In particular, this is convenient for setting up a bundle for daemon fibers:Another alternative (one of many) is to fork as a promise and use a finalizer: