Loading...
Searching...
No Matches
cond.h
Go to the documentation of this file.
1/*
2 * SPDX-FileCopyrightText: 2018 Sam Kumar
3 * SPDX-License-Identifier: LGPL-2.1-only
4 */
5
6#pragma once
7
137
138#include <stdbool.h>
139#include <stddef.h>
140
141#include "list.h"
142#include "mutex.h"
143
144#ifdef __cplusplus
145extern "C" {
146#endif
147
151typedef struct {
158} cond_t;
159
165#define COND_INIT { { NULL } }
166
176void cond_init(cond_t *cond);
177
184void cond_wait(cond_t *cond, mutex_t *mutex);
185
195void cond_signal(cond_t *cond);
196
207
208#ifdef __cplusplus
209}
210#endif
211
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.
struct list_node list_node_t
List node structure.
Mutex for thread synchronization.
Condition variable structure.
Definition cond.h:151
list_node_t queue
The process waiting queue of the condition variable.
Definition cond.h:157
Mutex structure.
Definition mutex.h:36