2024-03-28 23:42:56 +08:00
|
|
|
/*
|
|
|
|
* Copyright (c) 2006-2023, RT-Thread Development Team
|
|
|
|
*
|
|
|
|
* SPDX-License-Identifier: Apache-2.0
|
|
|
|
*
|
|
|
|
* Change Logs:
|
|
|
|
* Date Author Notes
|
|
|
|
* 2023-11-20 Shell Add cond var API in kernel
|
|
|
|
*/
|
|
|
|
|
2024-04-13 10:54:04 +08:00
|
|
|
#ifndef IPC_CONDVAR_H__
|
|
|
|
#define IPC_CONDVAR_H__
|
2024-03-28 23:42:56 +08:00
|
|
|
|
|
|
|
#include <rtthread.h>
|
|
|
|
|
|
|
|
typedef struct rt_condvar
|
|
|
|
{
|
|
|
|
#ifdef USING_RT_OBJECT
|
|
|
|
struct rt_object parent;
|
|
|
|
#endif
|
|
|
|
rt_atomic_t waiters_cnt;
|
|
|
|
rt_atomic_t waiting_mtx;
|
|
|
|
struct rt_wqueue event;
|
|
|
|
} *rt_condvar_t;
|
|
|
|
|
|
|
|
void rt_condvar_init(rt_condvar_t cv, char *name);
|
|
|
|
int rt_condvar_timedwait(rt_condvar_t cv, rt_mutex_t mtx, int suspend_flag,
|
|
|
|
rt_tick_t timeout);
|
|
|
|
int rt_condvar_signal(rt_condvar_t cv);
|
|
|
|
int rt_condvar_broadcast(rt_condvar_t cv);
|
|
|
|
|
|
|
|
rt_inline void rt_condvar_detach(rt_condvar_t cv)
|
|
|
|
{
|
|
|
|
RT_UNUSED(cv);
|
|
|
|
return ;
|
|
|
|
}
|
|
|
|
|
2024-04-13 10:54:04 +08:00
|
|
|
#endif /* IPC_CONDVAR_H__ */
|