diff options
| author | xqyjlj <[email protected]> | 2024-01-02 14:17:45 +0800 |
|---|---|---|
| committer | Meco Man <[email protected]> | 2024-01-02 21:09:54 +0800 |
| commit | 92bd28f22bcdc2e0a72803cf65afe9bb2a387ad6 (patch) | |
| tree | 27e3a66ea5d445f73e0e6abe132156632861c2fe /src/thread.c | |
| parent | e7880a9713ef3efed9ad133231981761bcc3e4eb (diff) | |
🐞 fix(thread): fix thread sleep (deadlock)
Diffstat (limited to 'src/thread.c')
| -rw-r--r-- | src/thread.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/thread.c b/src/thread.c index 9f1a9f3cfb..94180a712c 100644 --- a/src/thread.c +++ b/src/thread.c @@ -654,8 +654,8 @@ rt_err_t rt_thread_sleep(rt_tick_t tick) rt_timer_start(&(thread->thread_timer)); /* enable interrupt */ - rt_hw_local_irq_enable(level); rt_spin_unlock(&(thread->spinlock)); + rt_hw_local_irq_enable(level); rt_exit_critical(); thread->error = -RT_EINTR; @@ -668,8 +668,8 @@ rt_err_t rt_thread_sleep(rt_tick_t tick) } else { - rt_hw_local_irq_enable(level); rt_spin_unlock(&(thread->spinlock)); + rt_hw_local_irq_enable(level); rt_exit_critical(); } @@ -737,8 +737,8 @@ rt_err_t rt_thread_delay_until(rt_tick_t *tick, rt_tick_t inc_tick) rt_timer_control(&(thread->thread_timer), RT_TIMER_CTRL_SET_TIME, &left_tick); rt_timer_start(&(thread->thread_timer)); - rt_hw_local_irq_enable(level); rt_spin_unlock(&(thread->spinlock)); + rt_hw_local_irq_enable(level); rt_exit_critical(); rt_schedule(); |
