Skip to content

Commit 65fafe0

Browse files
committed
Fix missing schedule when thread actively suspends itself
Signed-off-by: mouch6131 <[email protected]>
1 parent 169d84d commit 65fafe0

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/thread.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -980,6 +980,11 @@ rt_err_t rt_thread_suspend_to_list(rt_thread_t thread, rt_list_t *susp_list, int
980980
rt_sched_unlock(slvl);
981981

982982
RT_OBJECT_HOOK_CALL(rt_thread_suspend_hook, (thread));
983+
984+
/* if suspend by self, we need schedule anyway */
985+
if (rt_thread_self() == thread)
986+
rt_schedule();
987+
983988
return RT_EOK;
984989
}
985990
RTM_EXPORT(rt_thread_suspend_to_list);

0 commit comments

Comments
 (0)