summaryrefslogtreecommitdiffstats
path: root/cpukit/score/src/threadclearstate.c
diff options
context:
space:
mode:
authorSebastian Huber <sebastian.huber@embedded-brains.de>2016-05-13 07:12:38 +0200
committerSebastian Huber <sebastian.huber@embedded-brains.de>2016-05-20 07:49:38 +0200
commitf410ea82a4b9d5609ce170d2aa09027b5a7c4c50 (patch)
tree12a5af0bdefaa15bf4691b72928d71186cacff1c /cpukit/score/src/threadclearstate.c
parentscore: Add _Thread_Set_state_locked() (diff)
downloadrtems-f410ea82a4b9d5609ce170d2aa09027b5a7c4c50.tar.bz2
score: Add _Thread_Clear_state_locked()
This makes it possible to do thread state and thread life changes together under protection of the thread state lock. Update #2555. Update #2626.
Diffstat (limited to 'cpukit/score/src/threadclearstate.c')
-rw-r--r--cpukit/score/src/threadclearstate.c21
1 files changed, 16 insertions, 5 deletions
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;