File tree Expand file tree Collapse file tree 2 files changed +6
-13
lines changed
Expand file tree Collapse file tree 2 files changed +6
-13
lines changed Original file line number Diff line number Diff line change @@ -346,12 +346,6 @@ void pthread_exit(void *value)
346346 ptd -> tls = RT_NULL ;
347347 }
348348
349- if (ptd -> attr .detachstate == PTHREAD_CREATE_JOINABLE )
350- {
351- /* release the joinable pthread */
352- rt_sem_release (ptd -> joinable_sem );
353- }
354-
355349 /* detach thread */
356350 rt_thread_detach (ptd -> tid );
357351 /* reschedule thread */
Original file line number Diff line number Diff line change @@ -347,17 +347,17 @@ rt_err_t rt_thread_detach(rt_thread_t thread)
347347 /* change stat */
348348 thread -> stat = RT_THREAD_CLOSE ;
349349
350- /* detach object */
351- rt_object_detach ((rt_object_t )thread );
352-
353- if (thread -> cleanup != RT_NULL )
350+ if ((rt_object_is_systemobject ((rt_object_t )thread ) == RT_TRUE ) &&
351+ thread -> cleanup == RT_NULL )
352+ {
353+ rt_object_detach ((rt_object_t )thread );
354+ }
355+ else
354356 {
355357 /* disable interrupt */
356358 lock = rt_hw_interrupt_disable ();
357-
358359 /* insert to defunct thread list */
359360 rt_list_insert_after (& rt_thread_defunct , & (thread -> tlist ));
360-
361361 /* enable interrupt */
362362 rt_hw_interrupt_enable (lock );
363363 }
@@ -366,7 +366,6 @@ rt_err_t rt_thread_detach(rt_thread_t thread)
366366}
367367RTM_EXPORT (rt_thread_detach );
368368
369-
370369#ifdef RT_USING_HEAP
371370/**
372371 * This function will create a thread object and allocate thread object memory
You can’t perform that action at this time.
0 commit comments