fay-base-0.19.4: The base package for Fay.

Safe HaskellNone

Data.Mutex

Description

A trivial mutex.

Synopsis

Documentation

data Mutex Source

Constructors

Mutex (Var Bool) 

newMutex :: Fay MutexSource

Make a new unlocked mutex.

ifMutexFree :: Mutex -> Fay () -> Fay ()Source

If a mutex is free run the action, otherwise don't.

whenMutexFree :: Mutex -> Fay () -> Fay ()Source

Wait until the mutex is free to do something.

lockMutex :: Mutex -> (Fay () -> Fay a) -> Fay aSource

Lock the given mutex until I'm done with it.