SYNOPSIS
#include <pthread.h>
int pthread_mutex_init(pthread_mutex_t *mutex, const pthread_mutexattr_t *attr);
DESCRIPTION
The
A mutex can be statically initialized by assigning PTHREAD_MUTEX_INITIALIZER in its definition, as follows:
pthread_mutex_t def_mutex = PTHREAD_MUTEX_INITIALIZER;
A mutex must be initialized (either
by calling
PARAMETERS
- mutex
-
Is the mutex to initialize.
- attr
-
Specifies the attributes to use to initialize the mutex, or NULL if default attributes should be used.
RETURN VALUES
On success,
- EAGAIN
-
System resources (other than memory) are unavailable.
- EINVAL
-
attr does not refer to a valid condition variable attribute object.
- EFAULT
-
mutex or attr is an invalid pointer.
- ENOMEM
-
Insufficient memory exists to initialize the mutex.
CONFORMANCE
POSIX P1003.1 (1996)
MULTITHREAD SAFETY LEVEL
MT-safe.
PORTING ISSUES
None.
AVAILABILITY
PTC MKS Toolkit for Professional Developers
PTC MKS Toolkit for Professional Developers 64-Bit Edition
PTC MKS Toolkit for Enterprise Developers
PTC MKS Toolkit for Enterprise Developers 64-Bit Edition
SEE ALSO
- Functions:
pthread_mutex_destroy() ,pthread_mutexattr_init()
PTC MKS Toolkit 10.4 Documentation Build 39.