1
  
2
  
3
  
4
  
5
  
6
  
7
  
8
  
9
  
10
  
11
  
12
  
13
  
14
  
15
  
16
  
17
  
18
  
19
  
20
  
21
  
22
  
23
  
24
  
25
  
26
  
27
  
28
  
29
  
30
  
31
  
32
  
33
  
34
  
35
  
36
  
37
  
38
  
39
  
40
  
41
  
42
  
NAME 
        /precompiled/mutex - mutex locks 
 
DESCRIPTION 
        /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. 
 
NOTA BENE 
        Mutex locks are only available on systems with POSIX threads support. 
 
============================================================================ 
NAME 
        lock - lock the mutex 
 
SYNTAX 
        object mutex->lock(); 
 
DESCRIPTION 
        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 
        be unlocked. 
 
============================================================================ 
NAME 
        trylock - try to lock the mutex 
 
SYNTAX 
        object mutex->trylock(); 
 
DESCRIPTION 
        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. 
 
============================================================================