File tree Expand file tree Collapse file tree 1 file changed +6
-7
lines changed Expand file tree Collapse file tree 1 file changed +6
-7
lines changed Original file line number Diff line number Diff line change @@ -326,17 +326,17 @@ rt_err_t rt_thread_detach(rt_thread_t thread)
326326 /* change stat */
327327 thread -> stat = RT_THREAD_CLOSE ;
328328
329- /* detach object */
330- rt_object_detach ((rt_object_t )thread );
331-
332- if (thread -> cleanup != RT_NULL )
329+ if ((rt_object_is_systemobject ((rt_object_t )thread ) == RT_TRUE ) &&
330+ thread -> cleanup == RT_NULL )
331+ {
332+ rt_object_detach ((rt_object_t )thread );
333+ }
334+ else
333335 {
334336 /* disable interrupt */
335337 lock = rt_hw_interrupt_disable ();
336-
337338 /* insert to defunct thread list */
338339 rt_list_insert_after (& rt_thread_defunct , & (thread -> tlist ));
339-
340340 /* enable interrupt */
341341 rt_hw_interrupt_enable (lock );
342342 }
@@ -345,7 +345,6 @@ rt_err_t rt_thread_detach(rt_thread_t thread)
345345}
346346RTM_EXPORT (rt_thread_detach );
347347
348-
349348#ifdef RT_USING_HEAP
350349/**
351350 * This function will create a thread object and allocate thread object memory
You can’t perform that action at this time.
0 commit comments