Name

pthread_mutex_destroy
- free resources allocated for a mutex

Library

libc_r.lib libpthread.lib libthr.lib

Synopsis

  #include <pthread.h>
  int pthread_mutex_destroy (pthread_mutex_t *mutex);

Return values

If successful, pthread_mutex_destroy will return zero, otherwise an error number will be returned to indicate the error.

Detailed description

The pthread_mutex_destroy function frees the resources allocated for mutex.

Examples

 pthread_mutexattr_t mta;
 int rc;
 /* Initialize a mutex attributes object */
 if((rc=pthread_mutexattr_init(&mta)) != 0) {
  fprintf(stderr,"Error at pthread_mutexattr_init(), rc=%d\n",rc);
  return -1;
 }
 /* Destroy the mutex attributes object */
 if((rc=pthread_mutexattr_destroy(&mta)) != 0) {
  fprintf(stderr,"Error at pthread_mutexattr_destroy(), rc=%d\n",rc);
  return -1;
 }

         

Errors

The pthread_mutex_destroy function will fail if:
[EINVAL]
  The value specified by mutex is invalid.
[EAGAIN]
  Mutex is locked by another thread.

See also

pthread_mutex_init, pthread_mutex_lock, pthread_mutex_trylock, pthread_mutex_unlock

Feedback

For additional information or queries on this page send feedback

© 2005-2007 Nokia

Top