diff options
-rw-r--r-- | cpukit/score/include/rtems/score/threadimpl.h | 5 | ||||
-rw-r--r-- | cpukit/score/src/threadclearstate.c | 21 |
2 files changed, 21 insertions, 5 deletions
diff --git a/cpukit/score/include/rtems/score/threadimpl.h b/cpukit/score/include/rtems/score/threadimpl.h index 09e338274b..68b9e72295 100644 --- a/cpukit/score/include/rtems/score/threadimpl.h +++ b/cpukit/score/include/rtems/score/threadimpl.h @@ -231,6 +231,11 @@ void _Thread_Cancel( Thread_Control *the_thread, Thread_Control *executing ); */ void _Thread_Close( Thread_Control *the_thread, Thread_Control *executing ); +States_Control _Thread_Clear_state_locked( + Thread_Control *the_thread, + States_Control state +); + /** * @brief Clears the specified thread state. * diff --git a/cpukit/score/src/threadclearstate.c b/cpukit/score/src/threadclearstate.c index 3da3538551..a67850ebfb 100644 --- a/cpukit/score/src/threadclearstate.c +++ b/cpukit/score/src/threadclearstate.c @@ -22,17 +22,15 @@ #include <rtems/score/assert.h> #include <rtems/score/schedulerimpl.h> -States_Control _Thread_Clear_state( +States_Control _Thread_Clear_state_locked( Thread_Control *the_thread, States_Control state ) { - ISR_lock_Context lock_context; - States_Control previous_state; + States_Control previous_state; _Assert( state != 0 ); - - _Thread_State_acquire( the_thread, &lock_context ); + _Assert( _Thread_State_is_owner( the_thread ) ); previous_state = the_thread->current_state; @@ -47,6 +45,19 @@ States_Control _Thread_Clear_state( } } + return previous_state; +} + +States_Control _Thread_Clear_state( + Thread_Control *the_thread, + States_Control state +) +{ + ISR_lock_Context lock_context; + States_Control previous_state; + + _Thread_State_acquire( the_thread, &lock_context ); + previous_state = _Thread_Clear_state_locked( the_thread, state ); _Thread_State_release( the_thread, &lock_context ); return previous_state; |