40 lines
831 B
C
40 lines
831 B
C
#pragma once
|
|
|
|
#include <rt/sem.h>
|
|
|
|
#include <stdbool.h>
|
|
|
|
#ifdef __cplusplus
|
|
extern "C" {
|
|
#endif
|
|
|
|
struct rt_cond;
|
|
struct rt_mutex;
|
|
|
|
void rt_cond_init(struct rt_cond *cond);
|
|
|
|
void rt_cond_signal(struct rt_cond *cond);
|
|
|
|
void rt_cond_broadcast(struct rt_cond *cond);
|
|
|
|
void rt_cond_wait(struct rt_cond *cond, struct rt_mutex *mutex);
|
|
|
|
bool rt_cond_timedwait(struct rt_cond *cond, struct rt_mutex *mutex,
|
|
unsigned long ticks);
|
|
|
|
struct rt_cond
|
|
{
|
|
struct rt_sem sem;
|
|
};
|
|
|
|
#define RT_COND_INIT(name) \
|
|
{ \
|
|
.sem = RT_SEM_INIT_BINARY(name.sem), \
|
|
}
|
|
|
|
#define RT_COND(name) struct rt_cond name = RT_COND_INIT(name)
|
|
|
|
#ifdef __cplusplus
|
|
}
|
|
#endif
|