zio.concurrent.MVar
See theMVar companion object
An MVar[A]
is a 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:
- As synchronized mutable variables,
- As channels, with
take
andput
asreceive
andsend
, and - As a binary semaphore
MVar[Unit]
, withtake
andput
aswait
andsignal
.
They were introduced in the paper "Concurrent Haskell" by Simon Peyton Jones, Andrew Gordon and Sigbjorn Finne.
Attributes
- Companion:
- object
- Graph
- Supertypes