diff options
| author | guo <[email protected]> | 2022-12-03 12:07:44 +0800 |
|---|---|---|
| committer | GitHub <[email protected]> | 2022-12-03 12:07:44 +0800 |
| commit | ecf2d8215961ca7c539132b62a72df6072cc3e14 (patch) | |
| tree | 59005f0f74f2593c0435059264f624c862a89f55 /components/drivers/ipc/waitqueue.c | |
| parent | aaf5462c6d4ae9466a0a8cd2a4bb00cfe1fef2f2 (diff) | |
sync branch rt-smart. (#6641)
* Synchronize the code of the rt mart branch to the master branch.
* TTY device
* Add lwP code from rt-smart
* Add vnode in DFS, but DFS will be re-write for rt-smart
* There are three libcpu for rt-smart:
* arm/cortex-a, arm/aarch64
* riscv64
Co-authored-by: Rbb666 <[email protected]>
Co-authored-by: zhkag <[email protected]>
Diffstat (limited to 'components/drivers/ipc/waitqueue.c')
| -rw-r--r-- | components/drivers/ipc/waitqueue.c | 26 |
1 files changed, 24 insertions, 2 deletions
diff --git a/components/drivers/ipc/waitqueue.c b/components/drivers/ipc/waitqueue.c index 97b5075638..25ebc71f68 100644 --- a/components/drivers/ipc/waitqueue.c +++ b/components/drivers/ipc/waitqueue.c @@ -118,13 +118,14 @@ void rt_wqueue_wakeup(rt_wqueue_t *queue, void *key) * * @return Return 0 if the thread is woken up. */ -int rt_wqueue_wait(rt_wqueue_t *queue, int condition, int msec) +static int _rt_wqueue_wait(rt_wqueue_t *queue, int condition, int msec, int suspend_flag) { int tick; rt_thread_t tid = rt_thread_self(); rt_timer_t tmr = &(tid->thread_timer); struct rt_wqueue_node __wait; rt_base_t level; + rt_err_t ret; /* current context checking */ RT_DEBUG_SCHEDULER_AVAILABLE(RT_TRUE); @@ -150,8 +151,14 @@ int rt_wqueue_wait(rt_wqueue_t *queue, int condition, int msec) goto __exit_wakeup; } + ret = rt_thread_suspend_with_flag(tid, suspend_flag); + if (ret != RT_EOK) + { + rt_hw_interrupt_enable(level); + /* suspend failed */ + return -RT_EINTR; + } rt_wqueue_add(queue, &__wait); - rt_thread_suspend(tid); /* start timer */ if (tick != RT_WAITING_FOREVER) @@ -176,3 +183,18 @@ __exit_wakeup: return tid->error; } + +int rt_wqueue_wait(rt_wqueue_t *queue, int condition, int msec) +{ + return _rt_wqueue_wait(queue, condition, msec, RT_UNINTERRUPTIBLE); +} + +int rt_wqueue_wait_killable(rt_wqueue_t *queue, int condition, int msec) +{ + return _rt_wqueue_wait(queue, condition, msec, RT_KILLABLE); +} + +int rt_wqueue_wait_interruptible(rt_wqueue_t *queue, int condition, int msec) +{ + return _rt_wqueue_wait(queue, condition, msec, RT_INTERRUPTIBLE); +} |
