ConcurrentUtils-0.3.0.0: Concurrent utilities

Safe HaskellNone
LanguageHaskell98

Control.CUtils.Deadlock

Description

Automatic deadlock prevention.

Automatic deadlock detection is inefficient, and computations cannot be rolled back or aborted in general.

Instead, we prevent deadlocks before they happen.

Synopsis

Documentation

data Res t u where Source

The Res arrow.

Constructors

Lift :: Kleisli IO t v -> Res v u -> Res t u 
Acq :: MVar () -> Res t u -> Res t u 
Rel :: MVar () -> Res t u -> Res t u 
Fork :: Res t () -> Res t u -> Res t u 
Plus :: Res t v -> Res u v -> Res (Either t u) v 
Id :: Res t t 

run :: Res t u -> t -> IO u Source

Use this to run computations built in the Res arrow. Pieces of the arrow that hold locks must be finitely examinable, otherwise it doesn't terminate.

lft :: IO a -> Res v u -> Res v u Source