|Maintainer||Bas van Dijk <email@example.com> , Roel van Dijk <firstname.lastname@example.org>|
A Broadcast variable is a mechanism for communication between threads. Multiple reader threads can wait until a broadcaster thread writes a signal. The readers retry until the signal is received. When the broadcaster sends the signal all readers are woken.
This module is designed to be imported qualified. We suggest importing it like:
import Control.Concurrent.STM.Broadcast ( Broadcast ) import qualified Control.Concurrent.STM.Broadcast as Broadcast ( ... )
A broadcast variable. It can be thought of as a box, which may be empty of full.
Create a new
Broadcast variable containing an initial value.
Write a new value into a
If the variable is empty any threads that are reading from the variable will be woken. If the variable is full its contents will simply be overwritten.