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 
188 
198 void cond_signal(cond_t *cond);
199 
209 void cond_broadcast(cond_t *cond);
210 
211 #ifdef __cplusplus
212 }
213 #endif
214 
215 #endif /* COND_H */
216 
cond_wait
void cond_wait(cond_t *cond, mutex_t *mutex)
Waits on a condition.
cond_t::queue
list_node_t queue
The process waiting queue of the condition variable.
Definition: cond.h:159
cond_signal
void cond_signal(cond_t *cond)
Wakes up one thread waiting on the condition variable.
cond_broadcast
void cond_broadcast(cond_t *cond)
Wakes up all threads waiting on the condition variable.
mutex.h
Mutex for thread synchronization.
cond_t
Condition variable structure.
Definition: cond.h:153
list_node
List node structure.
Definition: list.h:40
list.h
Intrusive linked list.
cond_init
void cond_init(cond_t *cond)
Initializes a condition variable.
mutex_t
Mutex structure.
Definition: mutex.h:120