module BatConcurrent:sig..end
type lock
This light-weight type is independent of the underlying locking
mechanism and can be used if you do not know whether your code
will run with vmthreads, Posix threads, coThreads, etc.
val create : enter:(unit -> unit) -> leave:(unit -> unit) -> lockenter : Enter critical section.leave : Leave critical section.
.val nolock : lockval synchronize : (unit -> lock) -> ('a -> 'b) -> 'a -> 'bsynchronize locker f returns a function f' which behaves as
f but whose executions are protected by one lock obtained from
locker. The same lock will be reused for all subsequent uses of
f'.
For instance,
synchronize Mutex.make f is a new function whose executions
will by synchronized by a new lock. Conversely,
synchronize (const my_lock) f is a new function whose executions
will be synchronized by an existing lock my_lock.
val sync : lock -> ('a -> 'b) -> 'a -> 'bsynchronized.
sync lock f behaves as synchronize (const lock) f but slightly faster
val compose : lock -> lock -> lockmodule type BaseLock =sig..end
module type Lock =sig..end
module MakeLock:
module NoLock:Lock