瀏覽代碼

[src][thread]fix rt_thread_resume return value error (#9114)

fix rt_thread_resume return value error
zms123456 1 年之前
父節點
當前提交
c018a3e3fd
共有 1 個文件被更改,包括 9 次插入0 次删除
  1. 9 0
      src/thread.c

+ 9 - 0
src/thread.c

@@ -1018,6 +1018,15 @@ rt_err_t rt_thread_resume(rt_thread_t thread)
     if (!error)
     {
         error = rt_sched_unlock_n_resched(slvl);
+
+        /**
+         * RT_ESCHEDLOCKED indicates that the current thread is in a critical section,
+         * rather than 'thread' can't be resumed. Therefore, we can ignore this error.
+         */
+        if (error == -RT_ESCHEDLOCKED)
+        {
+            error = RT_EOK;
+        }
     }
     else
     {