DOC HOME SITE MAP MAN PAGES GNU INFO SEARCH PRINT BOOK
 

rmutex_unlock(SYNCH)


rmutex_unlock -- unlock a recursive mutex

Synopsis

   cc [options] -Kthread file
   

#include <synch.h>

int rmutex_unlock(rmutex_t *rmutex);

Description

rmutex_unlock unlocks the recursive mutual exclusion lock (rmutex) pointed to by rmutex.

rmutex_unlock checks the identity of the caller and if the caller is the current owner of rmutex it checks the depth count.

If the caller is not the current owner of rmutex, that is, the caller does not hold the lock, rmutex_unlock will fail and return EACCES.

If there are one or more threads waiting for rmutex when it is unlocked, at least one waiting thread is allowed to try again to lock rmutex. 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


rmutex
pointer to recursive mutex to be unlocked

Return values

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

Errors

If any of the following conditions is detected, rmutex_unlock returns the corresponding value:

EACCES
the caller did not previously lock the rmutex

EINVAL
invalid argument specified

References

Intro(SYNCH), mutex(SYNCH), rmutex(SYNCH), rmutex_destroy(SYNCH), rmutex_init(SYNCH), rmutex_lock(SYNCH), rmutex_trylock(SYNCH)
© 2005 The SCO Group, Inc. All rights reserved.
SCO OpenServer Release 6.0.0 - 01 June 2005