forked from Imagelibrary/rtems
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.
This commit is contained in:
@@ -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 );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -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 */
|
||||
|
||||
Reference in New Issue
Block a user