pthread_mutex_unlock Subroutine


Unlocks a mutex.


Threads Library (libpthreads.a)



int pthread_mutex_unlock (mutex)
pthread_mutex_t *mutex;


The pthread_mutex_unlock subroutine unlocks the mutex mutex. It checks
the mutex owner and resets the mutex only if the calling thread is
the mutex owner; otherwise it returns an error.

Note:	The pthread.h header file must be the first included file of
each source file using the threads library.


mutex	Specifies the target mutex.

Return Values

Upon successful completion, 0 is returned. Otherwise, an error code
is returned.

Error Codes

The pthread_mutex_unlock subroutine is unsuccessful if the following
is true:

EINVAL	The mutex parameter is not valid.

EPERM	The calling thread does not own the mutex lock.

Implementation Specifics

These subroutines are part of the Base Operating System (BOS) Runtime.

Related Information

The pthread_mutex_lock or pthread_mutex_trylock subroutine.

Using Mutexes.

Threads Library Quick Reference.