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 
7 #pragma once
8 
139 #include <stdbool.h>
140 #include <stddef.h>
141 
142 #include "list.h"
143 #include "mutex.h"
144 
145 #ifdef __cplusplus
146 extern "C" {
147 #endif
148 
152 typedef struct {
159 } cond_t;
160 
166 #define COND_INIT { { NULL } }
167 
177 void cond_init(cond_t *cond);
178 
185 void cond_wait(cond_t *cond, mutex_t *mutex);
186 
196 void cond_signal(cond_t *cond);
197 
207 void cond_broadcast(cond_t *cond);
208 
209 #ifdef __cplusplus
210 }
211 #endif
212 
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:152
list_node_t queue
The process waiting queue of the condition variable.
Definition: cond.h:158
List node structure.
Definition: list.h:39
Mutex structure.
Definition: mutex.h:39