Classes

The following classes are available globally.

  • An MVar (pronounced “em-var”) is a synchronising variable, used for communication between concurrent threads. It can be thought of as a box, which may be empty or full.

    An MVar<A> is mutable location that is either empty or contains a value of type A. It has two fundamental operations: put(_:) which fills an MVar if it is empty and blocks otherwise, and take() which empties an MVar if it is full and blocks otherwise. They can be used in multiple different ways:

    1. As synchronized mutable variables,
    2. As channels, with take() and put(_:) as receive and send, and
    3. As a binary semaphore MVar<Void>, with take() and put(_:) as wait and signal.
    See more

    Declaration

    Swift

    public final class MVar<A>