module Netplex_mutex:Netplex-wide mutexessig
..end
Netplex_semaphore
, and use the same name space for named objects.
For implementation issues, see Netplex_semaphore
.
It is not required to create mutexes: A mutex is automatically created when the name is used for the first time. Mutexes are initially always in unlocked state.
Mutexes do not stack: A container cannot lock a mutex several times. (The second lock attempt would result in a deadlock.)
There is no deadlock detection.
If a container holding mutexes terminates the mutexes are automatically unlocked.
Mutex are not owned by their container. It is allowed that a different container unlocks the mutex.
Technically, a mutex named n
is implemented by a semaphore n
.
If the mutex is locked, the semaphore has the value 0, and if it is
unlocked, it has value 1.
val plugin : Netplex_types.plugin
add_plugin
method
with this object as argument. This can e.g. be done in the
post_add_hook
of the processor.Netplex_cenv.Not_in_container_thread
is raised.type
mutex
val access : string -> mutex
val lock : mutex -> unit
val unlock : mutex -> unit