locked-poll-0.1.0: Very simple poll lock

CopyrightPlow Technologies LLC
LicenseMIT License
MaintainerScott Murphy
Safe HaskellSafe
LanguageHaskell2010

LockedPoll

Description

>>> let keyFcn = fst :: (Int,a) -> Int
>>> lockingFunction <- makeLockingFunction 30 keyFcn

|

Synopsis

Documentation

type Key k = (Ord k, Eq k, Show k) Source

Key Constraint for locking down a traverse or fold

type KeyFcn st k = Key k => st -> k Source

Extract a key from a given state

makeLockingFunction :: forall k lockableState. (Key k, Show lockableState) => Int64 -> KeyFcn lockableState k -> IO ((lockableState -> IO ()) -> lockableState -> IO ()) Source

This locking Function is very simple It reads a key and assigns a time to it if that time has expored... then it unlocks if the nested action completes then it unlocks all concurrency and exception handling should be done inside the IO () Notice I say it unlocks, not that it kills a nascent thread. No such thing will happen automatically