mirror of
https://github.com/c-cube/moonpool.git
synced 2025-12-05 19:00:33 -05:00
add Moonpool_lwt.on_lwt_thread
This commit is contained in:
parent
f245f4913c
commit
8bd79c70b5
2 changed files with 6 additions and 0 deletions
|
|
@ -307,6 +307,7 @@ let spawn_lwt f : _ Lwt.t =
|
|||
lwt_fut
|
||||
|
||||
let spawn_lwt_ignore f = ignore (spawn_lwt f : unit Lwt.t)
|
||||
let on_lwt_thread = Main_state.on_lwt_thread
|
||||
|
||||
let lwt_main (f : _ -> 'a) : 'a =
|
||||
let st = setup () in
|
||||
|
|
|
|||
|
|
@ -45,6 +45,11 @@ val lwt_main : (Moonpool.Runner.t -> 'a) -> 'a
|
|||
(** [lwt_main f] sets the moonpool-lwt bridge up, runs lwt main, calls [f],
|
||||
destroys the bridge, and return the result of [f()]. *)
|
||||
|
||||
val on_lwt_thread : unit -> bool
|
||||
(** [on_lwt_thread ()] is true if the current thread is the one currently
|
||||
running {!lwt_main}.
|
||||
@raise Failure if {!lwt_main} was not called. *)
|
||||
|
||||
val lwt_main_runner : unit -> Moonpool.Runner.t
|
||||
(** The runner from {!lwt_main}. The runner is only going to work if {!lwt_main}
|
||||
is currently running in some thread.
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue