diff options
author | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2022-07-19 10:38:12 +0200 |
---|---|---|
committer | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2022-07-28 07:53:04 +0200 |
commit | 8a864bc62cd57fbd6dd35141e5beb582de9b7bff (patch) | |
tree | e82b7aff7b56ed5721fa6e3f35f6c39a82b9481d /cpukit/score/src/threadrestart.c | |
parent | score: Use priority inheritance for thread join (diff) | |
download | rtems-8a864bc62cd57fbd6dd35141e5beb582de9b7bff.tar.bz2 |
score: Use PTHREAD_CANCELED for _Thread_Cancel()
The rtems_task_delete() directive is basically just a combined pthread_cancel()
and pthread_join(). In addition, it removes the PTHREAD_DETACHED state. The
exit value returned by pthread_join() of threads cancelled by
rtems_task_delete() should reflect this by getting a PTHREAD_CANCELED value
instead of NULL which could be a normal exit value.
Close #4680.
Diffstat (limited to '')
-rw-r--r-- | cpukit/score/src/threadrestart.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/cpukit/score/src/threadrestart.c b/cpukit/score/src/threadrestart.c index bcf5dccc69..635143427c 100644 --- a/cpukit/score/src/threadrestart.c +++ b/cpukit/score/src/threadrestart.c @@ -55,6 +55,8 @@ #include <rtems/score/userextimpl.h> #include <rtems/score/watchdogimpl.h> +#include <pthread.h> + #define THREAD_JOIN_TQ_OPERATIONS &_Thread_queue_Operations_priority_inherit static void _Thread_Life_action_handler( @@ -433,8 +435,7 @@ static void _Thread_Try_life_change_request( Thread_Cancel_state _Thread_Cancel( Thread_Control *the_thread, Thread_Control *executing, - Thread_Life_state life_states_to_clear, - void *exit_value + Thread_Life_state life_states_to_clear ) { ISR_lock_Context lock_context; @@ -444,7 +445,7 @@ Thread_Cancel_state _Thread_Cancel( _Thread_State_acquire( the_thread, &lock_context ); - _Thread_Set_exit_value( the_thread, exit_value ); + _Thread_Set_exit_value( the_thread, PTHREAD_CANCELED ); previous = _Thread_Change_life_locked( the_thread, life_states_to_clear, @@ -476,8 +477,7 @@ Status_Control _Thread_Close( ); _ISR_lock_ISR_enable( &queue_context->Lock_context.Lock_context ); - cancel_state = - _Thread_Cancel( the_thread, executing, THREAD_LIFE_DETACHED, NULL ); + cancel_state = _Thread_Cancel( the_thread, executing, THREAD_LIFE_DETACHED ); if ( cancel_state == THREAD_CANCEL_DONE ) { _Thread_Dispatch_enable( cpu_self ); |