diff options
| author | geniusgogo <[email protected]> | 2023-12-24 19:55:04 +0800 |
|---|---|---|
| committer | GitHub <[email protected]> | 2023-12-24 19:55:04 +0800 |
| commit | 20a4d0939a5251b7b730f4f9f1beb0a4c0ca486a (patch) | |
| tree | 48493ea0e9133e216d38b11b80ce9fd53fb6a992 /src/thread.c | |
| parent | e1fdc13288eb110d8280f68594c2d87e14446437 (diff) | |
Fix softtimer resume (#8393)
Diffstat (limited to 'src/thread.c')
| -rw-r--r-- | src/thread.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/thread.c b/src/thread.c index bda2be0fa6..792d84e483 100644 --- a/src/thread.c +++ b/src/thread.c @@ -1059,16 +1059,18 @@ rt_err_t rt_thread_resume(rt_thread_t thread) LOG_D("thread resume: %s", thread->parent.name); + level = rt_spin_lock_irqsave(&(thread->spinlock)); //TODO need lock for cpu + if ((thread->stat & RT_THREAD_SUSPEND_MASK) != RT_THREAD_SUSPEND_MASK) { + rt_spin_unlock_irqrestore(&(thread->spinlock), level); + LOG_D("thread resume: thread disorder, %d", thread->stat); return -RT_ERROR; } - level = rt_spin_lock_irqsave(&(thread->spinlock)); //TODO need lock for cpu - /* remove from suspend list */ rt_list_remove(&(thread->tlist)); |
