MCPcopy Create free account
hub / github.com/RT-Thread/rt-thread / sys_thread_delete

Function sys_thread_delete

components/lwp/lwp_syscall.c:3972–3995  ·  view source on GitHub ↗

* @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_

Source from the content-addressed store, hash-verified

3970 * it. Otherwise, it might lead to undefined behavior or resource leaks.
3971 */
3972sysret_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.

Callers

nothing calls this directly

Calls 3

rt_thread_deleteFunction · 0.85
rt_thread_selfFunction · 0.85
rt_scheduleFunction · 0.50

Tested by

no test coverage detected