## Async

The full API is browsable here.

Async is a library for asynchronous programming, i.e., programming where some part of the program must wait for things that happen at times determined by some external entity (like a human or another program). This includes pretty much any program that uses blocking calls (e.g., networking code, disk access), timeouts, or event loops (e.g., GUIs).

In a nutshell, the idea is to use non-preemptive user-level threads and first-class blocking operations with blocking expressed in the type system.

Read more in Chapter 18 of Real World OCaml.

### Organization

Async comprises three packages, `Async_kernel`, `Async_unix`, and `Async_extra`.

- Async_kernel contains Async's core data structures, like `Deferred`. `Async_kernel` is portable, and so can be used in Javascript using Async_js. In principle it could also be used on Windows, but no scheduler has been written for Async on Windows as of yet.

- Async_unix adds Unix dependencies for connections and the scheduler (and manages e.g. hooking into epoll).

- Async_extra includes extras like command-line handling and RPC support built on top of those two packages.

You can most easily understand Async's API by reading the documentation of these individually.