module type Mutex_t =sig
..end
type
mutex
Type for a mutex.
module Control:Duppy.Monad.Mutex.Mutex_control
val create : unit -> mutex
create ()
creates a mutex.
val lock : mutex -> (unit, 'a) Duppy.Monad.t
A computation that locks a mutex
and returns unit
afterwards. Computation
will be blocked until the mutex is sucessfuly locked.
val try_lock : mutex -> (bool, 'a) Duppy.Monad.t
A computation that tries to lock a mutex.
Returns immediatly true
if the mutex was sucesfully locked
or false
otherwise.
val unlock : mutex -> (unit, 'a) Duppy.Monad.t
A computation that unlocks a mutex. Should return immediatly.