mutex_unlock(3synch)


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(3synch), mutex(3synch), mutex_destroy(3synch), mutex_init(3synch), mutex_lock(3synch), mutex_trylock(3synch)
© 2004 The SCO Group, Inc. All rights reserved.
UnixWare 7 Release 7.1.4 - 25 April 2004