summaryrefslogtreecommitdiffstats
path: root/cpukit/score
diff options
context:
space:
mode:
authorSebastian Huber <sebastian.huber@embedded-brains.de>2021-11-11 10:34:31 +0100
committerSebastian Huber <sebastian.huber@embedded-brains.de>2021-11-23 11:00:28 +0100
commite429e9742a2ca72820f8f3a8958ed138aa562bd9 (patch)
treebfb44686d6de38fbd5490cb0a37ed98f4fb0bd6e /cpukit/score
parentscore: Add _Thread_MP_Extract_proxy() (diff)
downloadrtems-e429e9742a2ca72820f8f3a8958ed138aa562bd9.tar.bz2
score: Simplify thread wait state handling
Remove the THREAD_WAIT_STATE_READY_AGAIN and simply use the initial value to indicate that a thread does not wait on something. Rename THREAD_WAIT_FLAGS_INITIAL to THREAD_WAIT_STATE_READY. This change is necessary so that _Thread_Continue() can be called for threads which never waited on something (for example dormant threads). Update #4546.
Diffstat (limited to 'cpukit/score')
-rw-r--r--cpukit/score/src/threadinitialize.c2
-rw-r--r--cpukit/score/src/threadqenqueue.c9
-rw-r--r--cpukit/score/src/threadtimeout.c8
3 files changed, 7 insertions, 12 deletions
diff --git a/cpukit/score/src/threadinitialize.c b/cpukit/score/src/threadinitialize.c
index 01ef479537..2682a9428c 100644
--- a/cpukit/score/src/threadinitialize.c
+++ b/cpukit/score/src/threadinitialize.c
@@ -299,7 +299,7 @@ static bool _Thread_Try_initialize(
the_thread->Wait.operations = &_Thread_queue_Operations_default;
the_thread->Start.initial_priority = config->priority;
- RTEMS_STATIC_ASSERT( THREAD_WAIT_FLAGS_INITIAL == 0, Wait_flags );
+ RTEMS_STATIC_ASSERT( THREAD_WAIT_STATE_READY == 0, Wait_flags );
/* POSIX Keys */
_RBTree_Initialize_empty( &the_thread->Keys.Key_value_pairs );
diff --git a/cpukit/score/src/threadqenqueue.c b/cpukit/score/src/threadqenqueue.c
index ed6c64543c..7b42cda88c 100644
--- a/cpukit/score/src/threadqenqueue.c
+++ b/cpukit/score/src/threadqenqueue.c
@@ -41,9 +41,6 @@
#define THREAD_QUEUE_BLOCKED \
(THREAD_WAIT_CLASS_OBJECT | THREAD_WAIT_STATE_BLOCKED)
-#define THREAD_QUEUE_READY_AGAIN \
- (THREAD_WAIT_CLASS_OBJECT | THREAD_WAIT_STATE_READY_AGAIN)
-
#if defined(RTEMS_SMP)
/*
* A global registry of active thread queue links is used to provide deadlock
@@ -560,7 +557,7 @@ static void _Thread_queue_Force_ready_again( Thread_Control *the_thread )
* We must set the wait flags under protection of the current thread lock,
* otherwise a _Thread_Timeout() running on another processor may interfere.
*/
- _Thread_Wait_flags_set( the_thread, THREAD_QUEUE_READY_AGAIN );
+ _Thread_Wait_flags_set( the_thread, THREAD_WAIT_STATE_READY );
_Thread_Wait_restore_default( the_thread );
}
@@ -576,13 +573,13 @@ static bool _Thread_queue_Make_ready_again( Thread_Control *the_thread )
success = _Thread_Wait_flags_try_change_release(
the_thread,
THREAD_QUEUE_INTEND_TO_BLOCK,
- THREAD_QUEUE_READY_AGAIN
+ THREAD_WAIT_STATE_READY
);
if ( success ) {
unblock = false;
} else {
_Assert( _Thread_Wait_flags_get( the_thread ) == THREAD_QUEUE_BLOCKED );
- _Thread_Wait_flags_set( the_thread, THREAD_QUEUE_READY_AGAIN );
+ _Thread_Wait_flags_set( the_thread, THREAD_WAIT_STATE_READY );
unblock = true;
}
diff --git a/cpukit/score/src/threadtimeout.c b/cpukit/score/src/threadtimeout.c
index 2f2017bebe..9431ff253d 100644
--- a/cpukit/score/src/threadtimeout.c
+++ b/cpukit/score/src/threadtimeout.c
@@ -35,9 +35,8 @@ void _Thread_Continue( Thread_Control *the_thread, Status_Control status )
wait_flags = _Thread_Wait_flags_get( the_thread );
- if ( ( wait_flags & THREAD_WAIT_STATE_READY_AGAIN ) == 0 ) {
+ if ( wait_flags != THREAD_WAIT_STATE_READY ) {
Thread_Wait_flags wait_class;
- Thread_Wait_flags ready_again;
bool success;
_Thread_Wait_cancel( the_thread, &queue_context );
@@ -45,11 +44,10 @@ void _Thread_Continue( Thread_Control *the_thread, Status_Control status )
the_thread->Wait.return_code = status;
wait_class = wait_flags & THREAD_WAIT_CLASS_MASK;
- ready_again = wait_class | THREAD_WAIT_STATE_READY_AGAIN;
success = _Thread_Wait_flags_try_change_release(
the_thread,
wait_class | THREAD_WAIT_STATE_INTEND_TO_BLOCK,
- ready_again
+ THREAD_WAIT_STATE_READY
);
if ( success ) {
@@ -59,7 +57,7 @@ void _Thread_Continue( Thread_Control *the_thread, Status_Control status )
_Thread_Wait_flags_get( the_thread )
== ( wait_class | THREAD_WAIT_STATE_BLOCKED )
);
- _Thread_Wait_flags_set( the_thread, ready_again );
+ _Thread_Wait_flags_set( the_thread, THREAD_WAIT_STATE_READY );
unblock = true;
}
} else {