From 2c9b7c10b9ff6b4509945376bb4e25dd18c1ce25 Mon Sep 17 00:00:00 2001 From: Shell Date: Wed, 1 May 2024 12:49:09 +0800 Subject: [kernel] add rt_thread_close() * [thread] Add rt_thread_close() This patch introduces a new function `rt_thread_close()` to enhances the usability and maintainability by providing a dedicated mechanism for closing threads. - A new function `rt_thread_close()` is added to the API, providing a standardized approach for closing threads. - The `rt_thread_close()` function removes a thread from the thread queue, updates its status to indicate closure, and performs the thread timer detaching which is a embedded timer in thread object. - Additionally, the `rt_thread_detach()` function is modified to utilize `rt_thread_close()` internally, streamlining the thread detachment process. Signed-off-by: Shell --- include/rtthread.h | 1 + 1 file changed, 1 insertion(+) (limited to 'include/rtthread.h') diff --git a/include/rtthread.h b/include/rtthread.h index 5e70c5dd63..a511a1f5c5 100644 --- a/include/rtthread.h +++ b/include/rtthread.h @@ -160,6 +160,7 @@ rt_thread_t rt_thread_create(const char *name, rt_uint8_t priority, rt_uint32_t tick); rt_err_t rt_thread_delete(rt_thread_t thread); +rt_err_t rt_thread_close(rt_thread_t thread); #endif /* RT_USING_HEAP */ rt_thread_t rt_thread_self(void); rt_thread_t rt_thread_find(char *name); -- cgit v1.3.1