DOC HOME SITE MAP MAN PAGES GNU INFO SEARCH PRINT BOOK
 
Threads

Mutual exclusion locks

A ``mutual exclusion lock'', or ``mutex'', allows only one thread at any time to access the resource being protected. The lock is acquired by the mutex_lock(S) function.

   int mutex_lock(
   	mutex_t *mutex
   );

If the lock is already held by some other thread, the calling thread will block in mutex_lock(S).

When the thread holding the lock calls mutex_unlock(S), some waiting thread (if any) will be made runnable.

   int mutex_unlock(
   	mutex_t *mutex
   );

The Threads Library does not enforce any notion of ownership of a lock by a thread. The thread unlocking a mutex need not be the same thread that locked the mutex.


Next topic: Spin locks
Previous topic: Locks

© 2005 The SCO Group, Inc. All rights reserved.
SCO OpenServer Release 6.0.0 -- 02 June 2005