cond.h
Go to the documentation of this file.
1 /*
2  * This file is subject to the terms and conditions of the GNU Lesser
3  * General Public License v2.1. See the file LICENSE in the top level
4  * directory for more details.
5  */
6 
137 #ifndef COND_H
138 #define COND_H
139 
140 #include <stdbool.h>
141 #include <stddef.h>
142 
143 #include "list.h"
144 #include "mutex.h"
145 
146 #ifdef __cplusplus
147 extern "C" {
148 #endif
149 
153 typedef struct {
160 } cond_t;
161 
167 #define COND_INIT { { NULL } }
168 
178 void cond_init(cond_t *cond);
179 
186 void cond_wait(cond_t *cond, mutex_t *mutex);
187 
197 void cond_signal(cond_t *cond);
198 
208 void cond_broadcast(cond_t *cond);
209 
210 #ifdef __cplusplus
211 }
212 #endif
213 
214 #endif /* COND_H */
void cond_broadcast(cond_t *cond)
Wakes up all threads waiting on the condition variable.
void cond_wait(cond_t *cond, mutex_t *mutex)
Waits on a condition.
void cond_init(cond_t *cond)
Initializes a condition variable.
void cond_signal(cond_t *cond)
Wakes up one thread waiting on the condition variable.
Intrusive linked list.
Mutex for thread synchronization.
Condition variable structure.
Definition: cond.h:153
list_node_t queue
The process waiting queue of the condition variable.
Definition: cond.h:159
List node structure.
Definition: list.h:40
Mutex structure.
Definition: mutex.h:146