diff --git a/src/lwt/moonpool_lwt.ml b/src/lwt/moonpool_lwt.ml index cbb40758..4838a3fb 100644 --- a/src/lwt/moonpool_lwt.ml +++ b/src/lwt/moonpool_lwt.ml @@ -306,6 +306,8 @@ let spawn_lwt f : _ Lwt.t = with exn -> Lwt.wakeup_exn lwt_prom exn); lwt_fut +let spawn_lwt_ignore f = ignore (spawn_lwt f : unit Lwt.t) + let lwt_main (f : _ -> 'a) : 'a = let st = setup () in (* make sure to cleanup *) diff --git a/src/lwt/moonpool_lwt.mli b/src/lwt/moonpool_lwt.mli index c97bbec1..63fb97c7 100644 --- a/src/lwt/moonpool_lwt.mli +++ b/src/lwt/moonpool_lwt.mli @@ -27,6 +27,9 @@ val spawn_lwt : (unit -> 'a) -> 'a Lwt.t (** This spawns a task that runs in the Lwt scheduler. @raise Failure if {!lwt_main} was not called. *) +val spawn_lwt_ignore : (unit -> unit) -> unit +(** Like {!spawn_lwt} but ignores the result, like [Lwt.async]. *) + val await_lwt : 'a Lwt.t -> 'a (** [await_lwt fut] awaits a Lwt future from inside a task running on a moonpool runner. This must be run from within a Moonpool runner so that the await-ing