Library
Module
Module type
Parameter
Class
Class type
Interoperability between Fuseau and Lwt.
This combines Fuseau
's fibers with the Lwt event loop (ie Lwt_engine
) to deal with timers and file descriptors readiness. In essence, one can use fibers and structured concurrency from Fuseau
alongside Lwt libraries and Lwt IO operations.
Here we have functions that are used to cross the boundary between the Fuseau world and the Lwt world.
val await_lwt : 'a Lwt.t -> 'a
Like Fuseau.await
but on a Lwt promise.
val spawn_as_lwt :
?parent:_ Fiber.t ->
?name:string ->
?propagate_cancel_to_parent:bool ->
(unit -> 'a) ->
'a Lwt.t
spawn_as_lwt f
runs f()
in the Fuseau+Lwt thread, and returns a Lwt future that resolves when the fiber does
val spawn_as_lwt_from_anywhere :
?name:string ->
Scheduler.t ->
(unit -> 'a) ->
'a Lwt.t
spawn_from_anywhere scheduler f
runs f()
as a toplevel fiber in scheduler
. It can be run from another thread.
module IO_lwt : sig ... end
IO through Lwt's engine
ev_read fd buf i len
is an event that, when ready, will ready at most len
bytes from fd
into buf[i.. i+len]
, and return how many bytes were read. It uses Lwt_engine
to wait for fd
's readiness.
ev_write fd buf i len
is an event that, when ready, writes at most len
bytes from buf
into fd
. It uses Lwt_engine
to wait for fd
's readiness.
module Iostream : sig ... end
Iostream specialized for Lwt
module Net : sig ... end
Networking using Lwt_io