skip-var-0.1.0.0: Skip variables

Control.Concurrent.SVar

Description

Synopsis

# SVar

data SVar a Source #

An SVar (skip variable) is a variable which allows for non-blocking updates, and blocking reads if the stored data has been read already, or if there is no data.

# Creation of SVars

Create an empty SVar.

newSVar :: a -> IO (SVar a) Source #

Create an SVar which contains the supplied value.

# Modification of SVars

putSVar :: SVar a -> a -> IO () Source #

Put a value into an SVar. Never blocks, always overwrites the current value, if there is one.

readSVar :: SVar a -> IO a Source #

Read a value from an SVar. Blocks if there isn't a new value since the last read, or if the SVar is empty.