pthread_cond.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2014 Hamburg University of Applied Sciences (HAW)
3  *
4  * This file is subject to the terms and conditions of the GNU Lesser
5  * General Public License v2.1. See the file LICENSE in the top level
6  * directory for more details.
7  */
8 
17 #ifndef PTHREAD_COND_H
18 #define PTHREAD_COND_H
19 
20 #include <time.h>
21 #include "mutex.h"
22 #include "priority_queue.h"
23 
24 #if defined(__WITH_AVRLIBC__)
25 /* avr-libc 'time.h' does not include 'sys/types.h' but we need 'clockid_t' */
26 # include <sys/types.h>
27 #endif
28 
29 #ifdef __MACH__
30 /* needed for AVAILABLE_MAC_OS_X_VERSION_10_12_AND_LATER */
31 #include <AvailabilityMacros.h>
32 #if !defined(AVAILABLE_MAC_OS_X_VERSION_10_12_AND_LATER)
33 typedef int clockid_t;
34 #endif
35 #endif
36 
37 #ifdef __cplusplus
38 extern "C" {
39 #endif
40 
44 typedef struct {
46  int __dummy;
48 
54 typedef struct {
57 
64 
71 
79 int pthread_condattr_getpshared(const pthread_condattr_t *attr, int *pshared);
80 
88 int pthread_condattr_setpshared(pthread_condattr_t *attr, int pshared);
89 
97 int pthread_condattr_getclock(const pthread_condattr_t *attr, clockid_t *clock_id);
98 
106 int pthread_condattr_setclock(pthread_condattr_t *attr, clockid_t clock_id);
107 
115 
122 
129 int pthread_cond_wait(pthread_cond_t *cond, mutex_t *mutex);
130 
138 int pthread_cond_timedwait(pthread_cond_t *cond, mutex_t *mutex, const struct timespec *abstime);
139 
146 
153 
154 #ifdef __cplusplus
155 }
156 #endif
157 
158 #endif /* PTHREAD_COND_H */
159 
pthread_cond_init
int pthread_cond_init(pthread_cond_t *cond, pthread_condattr_t *attr)
Initializes a condition variable object.
pthread_condattr_getclock
int pthread_condattr_getclock(const pthread_condattr_t *attr, clockid_t *clock_id)
Get the clock selected for the condition variable attribute attr.
priority_queue.h
A simple priority queue.
pthread_cond_condattr_init
int pthread_cond_condattr_init(pthread_condattr_t *attr)
Initializes a condition attribute variable object using default values.
pthread_cond_broadcast
int pthread_cond_broadcast(pthread_cond_t *cond)
unblock all threads that are currently blocked on the specified condition variable cond
pthread_condattr_t::__dummy
int __dummy
dumdidum
Definition: pthread_cond.h:46
pthread_condattr_getpshared
int pthread_condattr_getpshared(const pthread_condattr_t *attr, int *pshared)
Get the process-shared attribute in an initialized attributes object referenced by attr.
pthread_cond_destroy
int pthread_cond_destroy(pthread_cond_t *cond)
Destroy the condition variable cond.
pthread_cond_timedwait
int pthread_cond_timedwait(pthread_cond_t *cond, mutex_t *mutex, const struct timespec *abstime)
blocks the calling thread until the specified condition cond is signalled
mutex.h
Mutex for thread synchronization.
pthread_cond_t
Condition variable.
Definition: pthread_cond.h:54
pthread_cond_wait
int pthread_cond_wait(pthread_cond_t *cond, mutex_t *mutex)
blocks the calling thread until the specified condition cond is signalled
pthread_cond_condattr_destroy
int pthread_cond_condattr_destroy(pthread_condattr_t *attr)
Uninitializes a condition attribute variable object.
pthread_condattr_setclock
int pthread_condattr_setclock(pthread_condattr_t *attr, clockid_t clock_id)
Set the clock selected for the condition variable attribute ATTR.
priority_queue_t
data type for priority queues
Definition: priority_queue.h:41
pthread_cond_t::queue
priority_queue_t queue
Threads currently waiting to be signaled.
Definition: pthread_cond.h:55
pthread_condattr_t
Definition: pthread_cond.h:44
pthread_condattr_setpshared
int pthread_condattr_setpshared(pthread_condattr_t *attr, int pshared)
Set the process-shared attribute in an initialized attributes object referenced by attr.
pthread_cond_signal
int pthread_cond_signal(pthread_cond_t *cond)
unblock at least one of the threads that are blocked on the specified condition variable cond
mutex_t
Mutex structure.
Definition: mutex.h:120