DOC HOME SITE MAP MAN PAGES GNU INFO SEARCH PRINT BOOK
 

rmutex_unlock(3synch)


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(3synch), mutex(3synch), rmutex(3synch), rmutex_destroy(3synch), rmutex_init(3synch), rmutex_lock(3synch), rmutex_trylock(3synch)
© 2004 The SCO Group, Inc. All rights reserved.
UnixWare 7 Release 7.1.4 - 25 April 2004