Destroys a mutex.
1 – C Binding
#include <pthread.h>
int
pthread_mutex_destroy (
pthread_mutex_t *mutex);
2 – Arguments
mutex
The mutex to be destroyed.
3 – Description
This routine destroys the specified mutex by uninitializing it,
and should be called when a mutex object is no longer referenced.
After this routine is called, the Threads Library may reclaim
internal storage used by the specified mutex.
It is safe to destroy an initialized mutex that is unlocked.
However, it is illegal to destroy a locked mutex.
The results of this routine are unpredictable if the mutex object
specified in the mutex argument does not currently exist, or is
not initialized.
4 – Return Values
If an error condition occurs, this routine returns an integer
value indicating the type of error. Possible return values are as
follows:
Return Description
0 Successful completion.
[EBUSY] An attempt was made to destroy the object referenced
by mutex while it is locked.
[EINVAL] The value specified by mutex is not a valid mutex.
5 – Associated Routines
pthread_mutex_init()
pthread_mutex_lock()
pthread_mutex_trylock()
pthread_mutex_unlock()