[Return to Bookshelf] [Contents] [Previous Section] [Next Section] [Index] [Help]


pthread_mutex_destroy

Destroys a mutex.

Syntax

pthread_mutex_destroy(
                      mutex );
 


Argument Data Type Access

mutex opaque pthread_mutex_t write


C Binding

#include 

int pthread_mutex_destroy ( pthread_mutex_t *mutex);

Arguments

mutex
The mutex to be destroyed.

Description

This routine destroys a mutex by uninitializing it, and should be called when a mutex object is no longer referenced. This routine may reclaim internal storage used by the mutex object.

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.

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 is made to destroy the object referenced by mutex while it is locked or referenced. [EINVAL] The value specified by mutex is invalid.


Associated Routines

   pthread_mutex_init
   pthread_mutex_lock
   pthread_mutex_trylock
   pthread_mutex_unlock



[Return to Bookshelf] [Contents] [Previous Section] [Next Section] [Index] [Help]