Skip to content

Commit d835010

Browse files
author
Christopher Zimmermann
committed
Document Lwt.pause semantics in Lwt_main
1 parent 65dd0f3 commit d835010

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/unix/lwt_main.mli

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,12 @@ let () = Lwt_main.run (main ())
4040
error (i.e., code making such a call is inherently broken).
4141
4242
It is not safe to call [Lwt_main.run] in a function registered with
43-
[Pervasives.at_exit], use {!Lwt_main.at_exit} instead. *)
43+
[Pervasives.at_exit], use {!Lwt_main.at_exit} instead.
44+
45+
[Lwt.pause] allows the scheduler to run other promises before fulfilling
46+
the returned promise. To process all pending IO and allow all pending
47+
threads to run one currently needs to need to call Lwt.pause twice:
48+
[Lwt.pause () >>= Lwt.pause] *)
4449

4550
val yield : unit -> unit Lwt.t [@@deprecated "Use Lwt.pause instead"]
4651
(** [yield ()] is a pending promise that is fulfilled after Lwt finishes

0 commit comments

Comments
 (0)