mirror of
https://github.com/c-cube/moonpool.git
synced 2025-12-06 03:05:30 -05:00
add Moonpool_lwt.spawn_lwt_ignore
This commit is contained in:
parent
2aabc30b70
commit
f245f4913c
2 changed files with 5 additions and 0 deletions
|
|
@ -306,6 +306,8 @@ let spawn_lwt f : _ Lwt.t =
|
||||||
with exn -> Lwt.wakeup_exn lwt_prom exn);
|
with exn -> Lwt.wakeup_exn lwt_prom exn);
|
||||||
lwt_fut
|
lwt_fut
|
||||||
|
|
||||||
|
let spawn_lwt_ignore f = ignore (spawn_lwt f : unit Lwt.t)
|
||||||
|
|
||||||
let lwt_main (f : _ -> 'a) : 'a =
|
let lwt_main (f : _ -> 'a) : 'a =
|
||||||
let st = setup () in
|
let st = setup () in
|
||||||
(* make sure to cleanup *)
|
(* make sure to cleanup *)
|
||||||
|
|
|
||||||
|
|
@ -27,6 +27,9 @@ val spawn_lwt : (unit -> 'a) -> 'a Lwt.t
|
||||||
(** This spawns a task that runs in the Lwt scheduler.
|
(** This spawns a task that runs in the Lwt scheduler.
|
||||||
@raise Failure if {!lwt_main} was not called. *)
|
@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
|
val await_lwt : 'a Lwt.t -> 'a
|
||||||
(** [await_lwt fut] awaits a Lwt future from inside a task running on a moonpool
|
(** [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
|
runner. This must be run from within a Moonpool runner so that the await-ing
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue