Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

pthread_mutexattr_init(3c) [opensolaris man page]

pthread_mutexattr_init(3C)				   Standard C Library Functions 				pthread_mutexattr_init(3C)

NAME
pthread_mutexattr_init, pthread_mutexattr_destroy - initialize or destroy mutex attributes object SYNOPSIS
cc -mt [ flag... ] file... -lpthread [ library... ] #include <pthread.h> int pthread_mutexattr_init(pthread_mutexattr_t *attr); int pthread_mutexattr_destroy(pthread_mutexattr_t *attr); DESCRIPTION
The pthread_mutexattr_init() function initializes a mutex attributes object attr with the default value for all of the attributes defined by the implementation. The effect of initializing an already initialized mutex attributes object is undefined. After a mutex attributes object has been used to initialize one or more mutexes, any function affecting the attributes object (including destruction) does not affect any previously initialized mutexes. The pthread_mutexattr_destroy() function destroys a mutex attributes object; the object becomes, in effect, uninitialized. An implementa- tion may cause pthread_mutexattr_destroy() to set the object referenced by attr to an invalid value. A destroyed mutex attributes object can be re-initialized using pthread_mutexattr_init(); the results of otherwise referencing the object after it has been destroyed are undefined. RETURN VALUES
Upon successful completion, pthread_mutexattr_init() and pthread_mutexattr_destroy() return 0. Otherwise, an error number is returned to indicate the error. ERRORS
The pthread_mutexattr_init() function may fail if: ENOMEM Insufficient memory exists to initialize the mutex attributes object. The pthread_mutexattr_destroy() function may fail if: EINVAL The value specified by attr is invalid. ATTRIBUTES
See attributes(5) for descriptions of the following attributes: +-----------------------------+-----------------------------+ | ATTRIBUTE TYPE | ATTRIBUTE VALUE | +-----------------------------+-----------------------------+ |Interface Stability |Standard | +-----------------------------+-----------------------------+ |MT-Level |MT-Safe | +-----------------------------+-----------------------------+ SEE ALSO
pthread_cond_init(3C), pthread_create(3C), pthread_mutex_init(3C), pthread_mutexattr_settype(3C), attributes(5), standards(5) SunOS 5.11 23 Mar 2005 pthread_mutexattr_init(3C)

Check Out this Related Man Page

PTHREAD_MUTEXATTR(3)					   BSD Library Functions Manual 				      PTHREAD_MUTEXATTR(3)

NAME
pthread_mutexattr_init, pthread_mutexattr_destroy, pthread_mutexattr_setprioceiling, pthread_mutexattr_getprioceiling, pthread_mutexattr_setprotocol, pthread_mutexattr_getprotocol, pthread_mutexattr_settype, pthread_mutexattr_gettype -- mutex attribute opera- tions LIBRARY
POSIX Threads Library (libpthread, -lpthread) SYNOPSIS
#include <pthread.h> int pthread_mutexattr_init(pthread_mutexattr_t *attr); int pthread_mutexattr_destroy(pthread_mutexattr_t *attr); int pthread_mutexattr_setprioceiling(pthread_mutexattr_t *attr, int prioceiling); int pthread_mutexattr_getprioceiling(pthread_mutexattr_t *attr, int *prioceiling); int pthread_mutexattr_setprotocol(pthread_mutexattr_t *attr, int protocol); int pthread_mutexattr_getprotocol(pthread_mutexattr_t *attr, int *protocol); int pthread_mutexattr_settype(pthread_mutexattr_t *attr, int type); int pthread_mutexattr_gettype(pthread_mutexattr_t *attr, int *type); DESCRIPTION
Mutex attributes are used to specify parameters to pthread_mutex_init(). One attribute object can be used in multiple calls to pthread_mutex_init(), with or without modifications between calls. The pthread_mutexattr_init() function initializes attr with all the default mutex attributes. The pthread_mutexattr_destroy() function destroys attr. The pthread_mutexattr_set*() functions set the attribute that corresponds to each function name. The pthread_mutexattr_get*() functions copy the value of the attribute that corresponds to each function name to the location pointed to by the second function parameter. RETURN VALUES
If successful, these functions return 0. Otherwise, an error number is returned to indicate the error. ERRORS
The pthread_mutexattr_init() function will fail if: [ENOMEM] Out of memory. The pthread_mutexattr_destroy() function will fail if: [EINVAL] Invalid value for attr. The pthread_mutexattr_setprioceiling() function will fail if: [EINVAL] Invalid value for attr, or invalid value for prioceiling. The pthread_mutexattr_getprioceiling() function will fail if: [EINVAL] Invalid value for attr. The pthread_mutexattr_setprotocol() function will fail if: [EINVAL] Invalid value for attr, or invalid value for protocol. The pthread_mutexattr_getprotocol() function will fail if: [EINVAL] Invalid value for attr. The pthread_mutexattr_settype() function will fail if: [EINVAL] Invalid value for attr, or invalid value for type. The pthread_mutexattr_gettype() function will fail if: [EINVAL] Invalid value for attr. SEE ALSO
pthread_mutex_init(3) STANDARDS
The pthread_mutexattr_init() and pthread_mutexattr_destroy() functions conform to ISO/IEC 9945-1:1996 (``POSIX.1'') The pthread_mutexattr_setprioceiling(), pthread_mutexattr_getprioceiling(), pthread_mutexattr_setprotocol(), pthread_mutexattr_getprotocol(), pthread_mutexattr_settype(), and pthread_mutexattr_gettype() functions conform to Version 2 of the Single UNIX Specification (``SUSv2'') BSD
May 1, 2000 BSD
Man Page