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(3synch) 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(3synch).

When the thread holding the lock calls mutex_unlock(3synch), 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

© 2004 The SCO Group, Inc. All rights reserved.
UnixWare 7 Release 7.1.4 - 27 April 2004