package batteries
Install
dune-project
Dependency
Authors
Maintainers
Sources
md5=b7f3b99f12f21b1da6b6aa13d993206d
sha512=8b7f2479eb0271bcfd9168887c1e4a9a815c512eab3ee61b150fc4dfa9ec803e4f73115155f20b3017e4a822148d0e6d1c1e8e5f96790fd691b419dd39a908a2
doc/batteries.unthreaded/BatConcurrent/index.html
Module BatConcurrentSource
Definition of concurrency primitives.
The light-weight type of a lock, i.e. a construction which may be used to guarantee that a section will not be interrupted by another thread.
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.
Create a lock from a pair of locking/unlocking functions
synchronize 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.
Specialized version of synchronized.
sync lock f behaves as synchronize (const lock) f but slightly faster