kernel: Deprecate k_thread_cancel() API
The only difference between this call and k_thread_abort() (beyond some minor performance deltas) is that "cancel" will act as a noop in cases where the thread has begun execution and will return an error. "Abort" always succeeds, of course. That is inherently racy when used as a "stop the thread" API: there's no way in general (or at all in SMP situations) to know that you're calling this function "early enough" to catch the thread before it starts. Effectively, all k_thread_cancel() gives you that k_thread_abort() doesn't is an indication about whether or not a thread has started. There are many other ways to get that information that don't require dangerous kernel APIs. Deprecate this function. Zephyr's own code never used it except for its own unit test. Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
This commit is contained in:
parent
15cb5d7293
commit
3f55dafebc
4 changed files with 3 additions and 65 deletions
|
@ -717,8 +717,10 @@ __syscall k_tid_t k_current_get(void);
|
|||
*
|
||||
* @retval 0 Thread spawning canceled.
|
||||
* @retval -EINVAL Thread has already started executing.
|
||||
*
|
||||
* @deprecated This API is deprecated. Use k_thread_abort().
|
||||
*/
|
||||
__syscall int k_thread_cancel(k_tid_t thread);
|
||||
__deprecated __syscall int k_thread_cancel(k_tid_t thread);
|
||||
|
||||
/**
|
||||
* @brief Abort a thread.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue