* @brief Deletes a thread. * * This system call is used to delete an existing thread. The specified thread is terminated, * and its resources are released. If the thread is currently running, it will be forcefully * terminated. The thread identifier (`thread`) refers to the thread that is to be deleted. * * @param[in] thread The identifier of the thread to be deleted. * * @return sysret_
| 3970 | * it. Otherwise, it might lead to undefined behavior or resource leaks. |
| 3971 | */ |
| 3972 | sysret_t sys_thread_delete(rt_thread_t thread) |
| 3973 | { |
| 3974 | #ifdef ARCH_MM_MMU |
| 3975 | return rt_thread_delete(thread); |
| 3976 | #else |
| 3977 | sysret_t ret = 0; |
| 3978 | |
| 3979 | if(thread->parent.type != RT_Object_Class_Thread) |
| 3980 | { |
| 3981 | ret = -EINVAL; |
| 3982 | goto __exit; |
| 3983 | } |
| 3984 | |
| 3985 | ret = rt_thread_delete(thread); |
| 3986 | |
| 3987 | if (rt_thread_self() == thread) |
| 3988 | { |
| 3989 | rt_schedule(); |
| 3990 | } |
| 3991 | |
| 3992 | __exit: |
| 3993 | return ret; |
| 3994 | #endif |
| 3995 | } |
| 3996 | |
| 3997 | /** |
| 3998 | * @brief Starts a previously created thread. |
nothing calls this directly
no test coverage detected