From 56729d83c99ee393c707acfcbcd7d290f97fd07d Mon Sep 17 00:00:00 2001 From: Sebastian Huber Date: Thu, 23 Apr 2015 21:29:56 +0200 Subject: score: Delete STATES_WAITING_ON_THREAD_QUEUE Avoid the usage of the current thread state in _Thread_queue_Extract_with_return_code() since thread queues should not know anything about thread states. --- cpukit/posix/src/psignalunblockthread.c | 6 +++--- cpukit/score/include/rtems/score/statesimpl.h | 26 ++------------------------ cpukit/score/src/threadqenqueue.c | 5 ++--- 3 files changed, 7 insertions(+), 30 deletions(-) diff --git a/cpukit/posix/src/psignalunblockthread.c b/cpukit/posix/src/psignalunblockthread.c index c56c1502a1..1b3db68262 100644 --- a/cpukit/posix/src/psignalunblockthread.c +++ b/cpukit/posix/src/psignalunblockthread.c @@ -114,11 +114,11 @@ bool _POSIX_signals_Unblock_thread( * In pthread_cond_wait, a thread will be blocking on a thread * queue, but is also interruptible by a POSIX signal. */ - if ( _States_Is_waiting_on_thread_queue(the_thread->current_state) ) - _Thread_queue_Extract_with_proxy( the_thread ); - else if ( _States_Is_delaying(the_thread->current_state) ) { + if ( _States_Is_delaying(the_thread->current_state) ) { (void) _Watchdog_Remove( &the_thread->Timer ); _Thread_Unblock( the_thread ); + } else { + _Thread_queue_Extract_with_proxy( the_thread ); } } } diff --git a/cpukit/score/include/rtems/score/statesimpl.h b/cpukit/score/include/rtems/score/statesimpl.h index 9f94675c89..d1c402e643 100644 --- a/cpukit/score/include/rtems/score/statesimpl.h +++ b/cpukit/score/include/rtems/score/statesimpl.h @@ -105,19 +105,14 @@ extern "C" { STATES_WAITING_FOR_BSD_WAKEUP | \ STATES_WAITING_FOR_RWLOCK ) -/** This macro corresponds to a task waiting which is blocked on - * a thread queue. */ -#define STATES_WAITING_ON_THREAD_QUEUE \ - ( STATES_LOCALLY_BLOCKED | \ - STATES_WAITING_FOR_RPC_REPLY ) - /** This macro corresponds to a task waiting which is blocked. */ #define STATES_BLOCKED ( STATES_DELAYING | \ + STATES_LOCALLY_BLOCKED | \ STATES_WAITING_FOR_TIME | \ STATES_WAITING_FOR_PERIOD | \ STATES_WAITING_FOR_EVENT | \ + STATES_WAITING_FOR_RPC_REPLY | \ STATES_WAITING_FOR_SYSTEM_EVENT | \ - STATES_WAITING_ON_THREAD_QUEUE | \ STATES_INTERRUPTIBLE_BY_SIGNAL ) /** All state bits set to one (provided for _Thread_Ready()) */ @@ -414,23 +409,6 @@ RTEMS_INLINE_ROUTINE bool _States_Is_locally_blocked ( return (the_states & STATES_LOCALLY_BLOCKED); } -/** - * This function returns true if one of the states which indicates - * that a task is blocked waiting for a local resource is set in - * the_states, and false otherwise. - * - * @param[in] the_states is the task state set to test - * - * @return This method returns true if the state indicates that the - * assocated thread is waiting on a thread queue. - */ -RTEMS_INLINE_ROUTINE bool _States_Is_waiting_on_thread_queue ( - States_Control the_states -) -{ - return (the_states & STATES_WAITING_ON_THREAD_QUEUE); -} - /** * This function returns true if one of the states which indicates * that a task is blocked is set in the_states, and false otherwise. diff --git a/cpukit/score/src/threadqenqueue.c b/cpukit/score/src/threadqenqueue.c index 0e16f59c46..5f94ec99c9 100644 --- a/cpukit/score/src/threadqenqueue.c +++ b/cpukit/score/src/threadqenqueue.c @@ -194,13 +194,12 @@ void _Thread_queue_Extract_with_return_code( _Thread_queue_Acquire( &lock_context ); - if ( !_States_Is_waiting_on_thread_queue( the_thread->current_state ) ) { + the_thread_queue = the_thread->Wait.queue; + if ( the_thread_queue == NULL ) { _Thread_queue_Release( &lock_context ); return; } - the_thread_queue = the_thread->Wait.queue; - if ( the_thread_queue->discipline == THREAD_QUEUE_DISCIPLINE_FIFO ) { _Chain_Extract_unprotected( &the_thread->Object.Node ); } else { /* must be THREAD_QUEUE_DISCIPLINE_PRIORITY */ -- cgit v1.2.3