aivika-experiment-5.3: Simulation experiments for the Aivika library

Simulation.Aivika.Experiment.Concurrent.MVar

Description

Tested with: GHC 8.0.1

The module defines helper functions for working with synchronized variable MVar.

Synopsis

# Documentation

maybeReadMVar :: b -> (a -> IO b) -> MVar (Maybe a) -> IO b Source #

Like maybe but for the synchronized variable.

maybePutMVar :: MVar (Maybe a) -> IO a -> (a -> IO b) -> IO b Source #

Update the contents if the variable was empty and then return a result of applying the specified function to either the initial or current value.