Skip to content

Commit a144bf0

Browse files
committed
add Moonpool_lwt.spawn_lwt_ignore
1 parent f041520 commit a144bf0

File tree

2 files changed

+5
-0
lines changed

2 files changed

+5
-0
lines changed

src/lwt/moonpool_lwt.ml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -306,6 +306,8 @@ let spawn_lwt f : _ Lwt.t =
306306
with exn -> Lwt.wakeup_exn lwt_prom exn);
307307
lwt_fut
308308

309+
let spawn_lwt_ignore f = ignore (spawn_lwt f : unit Lwt.t)
310+
309311
let lwt_main (f : _ -> 'a) : 'a =
310312
let st = setup () in
311313
(* make sure to cleanup *)

src/lwt/moonpool_lwt.mli

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,9 @@ val spawn_lwt : (unit -> 'a) -> 'a Lwt.t
2727
(** This spawns a task that runs in the Lwt scheduler.
2828
@raise Failure if {!lwt_main} was not called. *)
2929

30+
val spawn_lwt_ignore : (unit -> unit) -> unit
31+
(** Like {!spawn_lwt} but ignores the result, like [Lwt.async]. *)
32+
3033
val await_lwt : 'a Lwt.t -> 'a
3134
(** [await_lwt fut] awaits a Lwt future from inside a task running on a moonpool
3235
runner. This must be run from within a Moonpool runner so that the await-ing

0 commit comments

Comments
 (0)