libmetal  latest
condition.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2016, Xilinx Inc. and Contributors. All rights reserved.
3  *
4  * SPDX-License-Identifier: BSD-3-Clause
5  */
6 
7 /*
8  * @file condition.h
9  * @brief Condition variable for libmetal.
10  */
11 
12 #ifndef __METAL_CONDITION__H__
13 #define __METAL_CONDITION__H__
14 
15 #include <metal/mutex.h>
16 #include <metal/utilities.h>
17 
18 #ifdef __cplusplus
19 extern "C" {
20 #endif
21 
27 struct metal_condition;
28 
33 static inline void metal_condition_init(struct metal_condition *cv);
34 
43 static inline int metal_condition_signal(struct metal_condition *cv);
44 
53 static inline int metal_condition_broadcast(struct metal_condition *cv);
54 
65 
68 #ifdef __cplusplus
69 }
70 #endif
71 
72 #include <metal/system/@PROJECT_SYSTEM@/condition.h>
73 
74 #endif /* __METAL_CONDITION__H__ */
static int metal_condition_signal(struct metal_condition *cv)
Notify one waiter.
static int metal_condition_broadcast(struct metal_condition *cv)
Notify all waiters.
int metal_condition_wait(struct metal_condition *cv, metal_mutex_t *m)
Block until the condition variable is notified.
Definition: condition.c:14
static void metal_condition_init(struct metal_condition *cv)
Initialize a libmetal condition variable.
Definition: condition.h:25
metal_mutex_t * m
mutex.
Definition: condition.h:26
Definition: mutex.h:28