Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

pthread_condattr_init(3) [freebsd man page]

PTHREAD_CONDATTR(3)					   BSD Library Functions Manual 				       PTHREAD_CONDATTR(3)

NAME
pthread_condattr_init, pthread_condattr_destroy, pthread_condattr_getclock, pthread_condattr_setclock, pthread_condattr_getpshared, pthread_condattr_setpshared -- condition attribute operations LIBRARY
POSIX Threads Library (libpthread, -lpthread) SYNOPSIS
#include <pthread.h> int pthread_condattr_init(pthread_condattr_t *attr); int pthread_condattr_destroy(pthread_condattr_t *attr); int pthread_condattr_getclock(pthread_condattr_t * restrict attr, clock_t * restrict clock_id); int pthread_condattr_setclock(pthread_condattr_t *attr, clock_t clock_id); int pthread_condattr_getpshared(pthread_condattr_t * restrict attr, int * restrict pshared); int pthread_condattr_setpshared(pthread_condattr_t *attr, int pshared); DESCRIPTION
Condition attribute objects are used to specify parameters to pthread_cond_init(). The pthread_condattr_init() function initializes a condition attribute object with the default attributes. The pthread_condattr_destroy() function destroys a condition attribute object. The pthread_condattr_getclock() function will put the value of the clock attribute from attr into the memory area pointed to by clock_id. The pthread_condattr_setclock() function will set the clock attribute of attr to the value specified in clock_id. The clock attribute affects the interpretation of abstime in pthread_cond_timedwait(3) and may be set to CLOCK_REALTIME (default) or CLOCK_MONOTONIC. The pthread_condattr_getpshared() function will put the value of the process-shared attribute from attr into the memory area pointed to by pshared. The pthread_condattr_setpshared() function will set the process-shared attribute of attr to the value specified in pshared. The argument pshared may have one of the following values: PTHREAD_PROCESS_PRIVATE The condition variable it is attached to may only be accessed by threads in the same process as the one that created the object. PTHREAD_PROCESS_SHARED The condition variable it is attached to may be accessed by threads in processes other than the one that created the object. RETURN VALUES
If successful, these functions return 0. Otherwise, an error number is returned to indicate the error. ERRORS
The pthread_condattr_init() function will fail if: [ENOMEM] Out of memory. The pthread_condattr_destroy() function will fail if: [EINVAL] Invalid value for attr. The pthread_condattr_setclock() function will fail if: [EINVAL] The value specified in clock_id is not one of the allowed values. The pthread_condattr_setpshared() function will fail if: [EINVAL] The value specified in pshared is not one of the allowed values. SEE ALSO
pthread_cond_init(3), pthread_cond_timedwait(3) STANDARDS
The pthread_condattr_init() and pthread_condattr_destroy() functions conform to ISO/IEC 9945-1:1996 (``POSIX.1'') BUGS
The implementation of condition variables does not fully conform to IEEE Std 1003.2 (``POSIX.2'') because the process-shared attribute is ignored; if any value other than PTHREAD_PROCESSES_PRIVATE is specified in a call to pthread_condattr_setpshared(), it will return EINVAL. BSD
May 9, 2010 BSD

Check Out this Related Man Page

pthread_condattr_getclock(3C)				   Standard C Library Functions 			     pthread_condattr_getclock(3C)

NAME
pthread_condattr_getclock, pthread_condattr_setclock - get and set the clock selection condition variable attribute SYNOPSIS
cc -mt [ flag... ] file... [ library... ] #include <pthread.h> int pthread_condattr_getclock( const pthread_condattr_t *restrict attr, clockid_t *restrict clock_id); int pthread_condattr_setclock(pthread_condattr_t *attr clockid_t clock_id); DESCRIPTION
The pthread_condattr_getclock() function obtains the value of the clock attribute from the attributes object referenced by attr. The pthread_condattr_setclock() function sets the clock attribute in an initialized attributes object referenced by attr. If pthread_con- dattr_setclock() is called with a clock_id argument that refers to a CPU-time clock, the call fails. The clock attribute is the clock ID of the clock that is used to measure the timeout service of pthread_cond_timedwait(3C). The default value of the clock attribute refers to the system clock. RETURN VALUES
Upon successful completion, the pthread_condattr_getclock() function returns 0 and stores the value of the clock attribute of attr into the object referenced by the clock_id argument. Otherwise, an error number is returned to indicate the error. Upon successful completion, the pthread_condattr_setclock() function returns 0. Otherwise, an error number is returned to indicate the error. ERRORS
These functions may fail if: EINVAL The value specified by attr is invalid. The pthread_condattr_setclock() function may fail if: EINVAL The value specified by clock_id does not refer to a known clock, or is a CPU-time clock. 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_cond_timedwait(3C), pthread_condattr_destroy(3C), pthread_condattr_getpshared(3C), pthread_create(3C), pthread_mutex_init(3C), attributes(5), standards(5) SunOS 5.11 30 Jan 2004 pthread_condattr_getclock(3C)
Man Page