pthread_mutex_destroy

Destroys the specified mutex.

Library:LibC
Classification:POSIX
Service:Synchronization

Syntax

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

Parameters

mutex

(IN) Points to the mutex to destroy.

Return Values

If successful, returns 0. Otherwise returns a nonzero error code.

Decimal

Constant

Description

9

EINVAL

The mutex parameter is invalid.

62

EBUSY

The mutex is being used by another thread.

Remarks

The mutex being destroyed must have been allocated by calling pthread_mutex_init. The pthread_mutex_destroy function does not release the memory for the mutex, but it does release the memory allocated with the pthread_mutex_init function.

You must free the memory for the mutex with the function that is paired with the function you used to allocate the memory. For example, if you used malloc to allocate the mutex, use free to release the memory.

See Also

pthread_mutex_init