Errors: [EINVAL] attr invalid.
Hint: Does not affect condition variables created using attr.
| pthread_condattr_getpshared...............................................[_pos
IX THREAD PROCESS SHARED]
int pthread_condattr_getpshared ( const pthread_condattr_t int
*attr, *pshared);
Determine whether condition variables created with attr can be shared by multiple processes.
pshared
PTHREAD_PROCESS_SHARED May be shared if in shared
memory.
PTHREAD_PROCESS_PRIVATE
Cannot be shared.
References: 3.3, 5.2.2
Headers: <pthread.h>
Errors: [EINVAL]attrinvalid.
Hint:
and used with
pthread_condattr_init
int pthread_condattr_init (
pthread_condattr_t *attr);
Initialize a condition variable attributes object with default attributes.
References: 3.3, 5.2.2
Headers: <pthread.h>
Errors: [ENOMEM] insufficient memory for attr.
Hint: Use to define condition variable types.
| pthread_condattr_setpshared................................................ [_POSIX_THREAD_PRocEss_sHARED]
int pthread_condattr_setpshared (
pthread_condattr_t *attr,
int pshared);
Condition variables created with attr can be shared between processes if the pthread_cond_t variable is allocated in memory shared by the processes.
pshared
PTHREAD_PROCESS_SHARED
PTHREAD_PROCESS_PRIVATE
May be shared if in shared memory.
Cannot be shared.
References: 3.3, 5.2.2 Headers: <pthread.h>
Errors: [EINVAL] attr or detachstate invalid.
Hint:
and used with
pthread_cond_destroy
int pthread_cond_destroy (
pthread_cond_t *cond);
Destroy condition variable cond that you no longer need.
References: 3.3, 5.2.2
Headers: <pthread.h>
Errors: [EBUSY]condisinuse.
[EINVAL] cond is invalid. Hint: Safest after wakeup from cond, when no other threads will wait.
| pthread_cond_init
int pthread cond init
(
pthread_cond_t
const pthread_condattr_t
*cond, *attr);
Initialize a condition variable cond. The attr argument specifies optional creation
attributes.
References:
Headers:
Errors:
Hint:
3.3, 5.2.2 <pthread.h>
[EAGAIN] insufficient resources (other than memory).
[ ENOMEM] insufficient memory.
[ EBUSY ] cond is already initialized.
[EINVAL] attr is invalid.
Use static initialization instead, if possible.
pthread_cond_broadcast
int pthread_cond_broadcast (
pthread_cond_t *cond);
Broadcast condition variable cond, waking all current waiters.
References: 3.3, 5.2.2
Headers: <pthread.h>
Errors: [EINVAL]condisinvalid.
Hint: Use when more than one waiter may respond to predicate change
or if any waiting thread may not be able to respond.
pthread_cond_signal
int pthread_cond_signal (
pthread_cond_t *cond);
Signal condition variable cond, waking one waiting thread. If SCHED_FIFO or SCHED_RR policy threads are waiting, the highest-priority waiter is awakened. Otherwise, an unspecified waiter is awakened.
References: 3.3, 5.2.2
Headers: <pthread.h>
Errors: [EINVAL]condisinvalid.
Hint: Use when any waiter can respond, and only one need respond. (All
waiters are equal.)
pthread_cond_timedwait
int pthread cond timedwait
pthread_cond_t pthread_mutex_t const struct timespec
*cond, *mutex, *abstime);
Wait on condition variable cond, until awakened by a signal or broadcast, or until the absolute time abstime is reached.
References:
Headers:
Errors:
Hint:
3.3, 5.2.2 <pthread.h>
[ETIMEDOUT] time specified by abstime has passed.
[EINVAL] cond, mutex, or abstime is invalid.