libmetal
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 
26 struct metal_condition;
27 
32 static inline void metal_condition_init(struct metal_condition *cv);
33 
42 static inline int metal_condition_signal(struct metal_condition *cv);
43 
52 static inline int metal_condition_broadcast(struct metal_condition *cv);
53 
64 
65 #include <metal/system/@PROJECT_SYSTEM@/condition.h>
66 
69 #ifdef __cplusplus
70 }
71 #endif
72 
73 #endif /* __METAL_CONDITION__H__ */
Definition: condition.h:25
static void metal_condition_init(struct metal_condition *cv)
Initialize a libmetal condition variable.
static int metal_condition_broadcast(struct metal_condition *cv)
Notify all waiters. Before calling this function, the caller should have acquired the mutex...
static int metal_condition_signal(struct metal_condition *cv)
Notify one waiter. Before calling this function, the caller should have acquired the mutex...
Definition: mutex.h:28
int metal_condition_wait(struct metal_condition *cv, metal_mutex_t *m)
Block until the condition variable is notified. Before calling this function, the caller should have ...
Definition: condition.c:14
metal_mutex_t * m
Definition: condition.h:26