未验证 提交 1bdde743 编写于 作者: mysterywolf's avatar mysterywolf 提交者: GitHub

[kernel] update comments for rt_thread_suspend (#5887)

* [kernel] update comments for rt_thread_suspend
上级 ee1e0a0d
/*
* Copyright (c) 2006-2021, RT-Thread Development Team
* Copyright (c) 2006-2022, RT-Thread Development Team
*
* SPDX-License-Identifier: Apache-2.0
*
......@@ -822,10 +822,11 @@ RTM_EXPORT(rt_thread_control);
* @brief This function will suspend the specified thread and change it to suspend state.
*
* @note This function ONLY can suspend current thread itself.
* Do not use the rt_thread_suspend and rt_thread_resume functions to synchronize the activities of threads.
* You have no way of knowing what code a thread is executing when you suspend it.
* If you suspend a thread while it is executing a critical area which is protected by a mutex,
* other threads attempt to use that mutex and have to wait. Deadlocks can occur very easily.
* rt_thread_suspend(rt_thread_self());
*
* Do not use the rt_thread_suspend to suspend other threads. You have no way of knowing what code a
* thread is executing when you suspend it. If you suspend a thread while sharing a resouce with
* other threads and occupying this resouce, starvation can occur very easily.
*
* @param thread is the thread to be suspended.
*
......@@ -872,8 +873,6 @@ RTM_EXPORT(rt_thread_suspend);
/**
* @brief This function will resume a thread and put it to system ready queue.
*
* @note Do not use the rt_thread_suspend and rt_thread_resume functions to synchronize the activities of threads.
*
* @param thread is the thread to be resumed.
*
* @return Return the operation status. If the return value is RT_EOK, the function is successfully executed.
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册