[kernel] update comments for rt_thread_suspend (#5887)

* [kernel] update comments for rt_thread_suspend
This commit is contained in:
Man, Jianting (Meco) 2022-04-29 02:46:28 -04:00 committed by GitHub
parent ee1e0a0df0
commit 1bdde74343
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 7 deletions

View File

@ -1,5 +1,5 @@
/*
* 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.