DOC HOME SITE MAP MAN PAGES GNU INFO SEARCH PRINT BOOK
 

mutex_unlock(SYNCH)


mutex_unlock -- unlock a mutex

Synopsis

   cc [options] -Kthread file
   

#include <synch.h>

int mutex_unlock(mutex_t *mutex);

Description

mutex_unlock unlocks the mutex pointed to by mutex.

If there are one or more threads waiting for the mutex when mutex_unlock is called, at least one waiting thread is allowed to try again to acquire the mutex. If more than one thread is waiting, the choice of which to release from the blocked group is scheduling-policy-specific: Bound threads have priority over multiplexed threads; then within each category the choice of thread is scheduling-policy-specific.

Parameters


mutex
pointer to mutex to be unlocked

Usage

Mutexes acquired with mutex_lock and mutex_trylock should be released with mutex_unlock.

Return values

mutex_unlock returns zero for success and an error number for failure.

Errors

If the following condition is detected, mutex_unlock returns the corresponding value:

EINVAL
invalid argument specified

References

Intro(SYNCH), mutex(SYNCH), mutex_destroy(SYNCH), mutex_init(SYNCH), mutex_lock(SYNCH), mutex_trylock(SYNCH)
© 2005 The SCO Group, Inc. All rights reserved.
SCO OpenServer Release 6.0.0 - 01 June 2005