Hardware Reference
In-Depth Information
mutex : A pointer to a pthread_mutex_t object , to be
initialized.
attr : A pointer to a pthread_mutexattr_t object, describing
mutex options. Supply zero (or NULL ), if you can accept the
defaults.
returns : Returns zero if the call is successful; otherwise,
returns an error code (not in errno ).
Error
Description
EAGAIN
The system lacks the necessary resources (other than memory)
to initialize another mutex.
ENOMEM
Insufficient memory exists to initialize the mutex.
EPERM
The caller does not have the privilege to perform the operation.
EBUSY
The implementation has detected an attempt to reinitialize the object
referenced by mutex, a previously initialized, but not yet destroyed,
mutex.
EINVAL
The value specified by attr is invalid.
An example of mutex initialization is provided here:
pthread_mutex_t mutex;
int rc;
rc = pthread_mutex_init(&mutex,0);
assert (!rc);
pthread_mutex_destroy(3)
When the application no longer needs a mutex, it should use pthread_mutex_destroy(3)
to release its resources:
pthread_mutex_t mutex ;
int rc;
...
rc = pthread_mutex_destroy(&mutex);
assert(!rc);
mutex : The address of the mutex to release resources for
returns : Returns zero when successful, or an error code when
it fails (not in errno )
 
 
Search WWH ::




Custom Search