|5d3c47||1996-10-06||Fredrik Hübinette (Hubbe)|| ||NAME
/precompiled/mutex - mutex locks
/precompiled/mutex is a precompiled Pike program that implements
mutal exclusion locks. Mutex locks are used to prevent multiple
threads from simultaneously execute sections of code which accesses
or changes shared data. The basic operations for a mutex is locking
and unlocking, if a thread attempts to lock an already locked mutex
the thread will sleep until the mutex is unlocked.
Mutex locks are only available on systems with POSIX threads support.
lock - lock the mutex
This function attempts to lock the mutex, if the mutex is already
locked current thread will sleep until the lock is unlocked by some
other thread. The value returned is the 'key' to the lock, which the
key is destructed or has no more references the lock will automatically
trylock - try to lock the mutex
This function preforms the same operation as lock(), but if the mutex
is already locked zero will be returned instead of sleeping until the
lock is unlocked.