Lwt - API Reference ¶
Core library ¶
The core library (lwt package) contains the Lwt module, which defines cooperative threads with all the primitives to manipulate them. It also provides several general purpose modules, which do not depend on any external package.
Module Lwt: cooperative light-weight threads.
Cooperative locks for mutual exclusion
Creating pools (for example pools of connections to a database).
Mutable sequence of elements
The lwt.log package provides a logger engine.
This package depends on the core library
Unix bindings ¶
The lwt.unix package provides:
- the Lwt_unix module, which wrap system calls into cooperative ones
- the Lwt_io module, which defines cooperative byte channel, in replacement of ones of the standard library
- module helpers for logging, spawning processes, ...
Interaction with the garbage collector
Buffered byte channels
Main loop and event queue
Lwt unix main loop engine
Cooperative system calls
This package depends on the core library, the unix package and the lwt.log package.
Reactive programming helpers ¶
The lwt.react package provides helpers for functionnal reactive programming with Lwt. It is based on the react package. The Lwt_react module is a replacement for the React module. It contains:
- all the functions of the React module
- Lwt specific primitives
- cooperative versions of react functions
This package depends on the core library and the react package.
caml4 syntax extensions ¶
Lwt is shipped with two syntax extensions. The first one, contained in the lwt.syntax package, aims to make coding with Lwt easier, and to make code more readable. The second, contained in the package lwt.syntax.log, is a camlp4 filter which decreases the performance penalty when using logging by inlining level tests.
Syntactic sugars for lwt
ppx syntax extension ¶
Ppx syntax extension for Lwt
The following modules are wrapper for integration of non-Lwt functions/packages into Lwt.
This module allows to mix preemptive threads with Lwt cooperative threads.