summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorYlne <[email protected]>2022-08-30 16:22:27 +0800
committerguo <[email protected]>2022-08-31 13:57:43 +0800
commitbfa357958d725d9f4883774150a27f605f46b631 (patch)
tree4c813a3971ddd110504b3d0e50c800df30fb1a01 /src
parent069086ae283055b1ce4076151ba1e11c3a6f1e2b (diff)
[kernel] 当tick为0时rt_thread_sleep不应该挂起线程
Diffstat (limited to 'src')
-rw-r--r--src/thread.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/thread.c b/src/thread.c
index e0c245f929..df6de24275 100644
--- a/src/thread.c
+++ b/src/thread.c
@@ -572,6 +572,11 @@ rt_err_t rt_thread_sleep(rt_tick_t tick)
rt_base_t level;
struct rt_thread *thread;
+ if (tick == 0)
+ {
+ return -RT_EINVAL;
+ }
+
/* set to current thread */
thread = rt_thread_self();
RT_ASSERT(thread != RT_NULL);