Core Help Root: Objects: mutex


Mutex is 'Mutual Exclusion'. Its purpose is preventing concurrent tasks from interfering with each other. A task grabbing mutex lock will suspend until all other tasks release the incompatible locks. Each lock has class and list of values. Two locks are incompatible if:

Primary mutex class is $mutex (note that grabbing $mutex will cause all attempts to grab locks with similar values to suspend). Its descendants allow programmer to set up finer locks, which allow multiple tasks to deal with nondisjoint value lists concurrently.

$mutex has the following functions:

.grab(@values)
Grab the list of values on the called class.
.release(@values)
Release the list from the class.
.release_all()
Release all the locks held by the current class. Use this call from connection objects and such.
.cleanup_dead_tasks()
Remove the dead tasks from this class.


the Cold Dark