Merge pull request #3872 from ErnestChen1/master

[fix] thread control bug about RT_THREAD_CTRL_CLOSE command
This commit is contained in:
Bernard Xiong 2020-09-03 10:36:04 +08:00 committed by GitHub
commit f3d1e71131
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 10 additions and 2 deletions

View File

@ -679,9 +679,17 @@ rt_err_t rt_thread_control(rt_thread_t thread, int cmd, void *arg)
case RT_THREAD_CTRL_STARTUP:
return rt_thread_startup(thread);
#ifdef RT_USING_HEAP
case RT_THREAD_CTRL_CLOSE:
return rt_thread_delete(thread);
if (rt_object_is_systemobject((rt_object_t)thread) == RT_TRUE)
{
return rt_thread_detach(thread);
}
#ifdef RT_USING_HEAP
else
{
return rt_thread_delete(thread);
}
#endif
#ifdef RT_USING_SMP