forked from Imagelibrary/rtems
score: _Thread_queue_Enqueue_with_handler()
Add thread parameter to _Thread_queue_Enqueue_with_handler() to avoid access to global _Thread_Executing.
This commit is contained in:
@@ -75,7 +75,7 @@ int _POSIX_Condition_variables_Wait_support(
|
||||
executing->Wait.queue = &the_cond->Wait_queue;
|
||||
executing->Wait.id = *cond;
|
||||
|
||||
_Thread_queue_Enqueue( &the_cond->Wait_queue, timeout );
|
||||
_Thread_queue_Enqueue( &the_cond->Wait_queue, executing, timeout );
|
||||
|
||||
_Objects_Put( &the_cond->Object );
|
||||
|
||||
|
||||
@@ -71,7 +71,11 @@ on_EINTR:
|
||||
} else {
|
||||
executing->Wait.return_argument = &return_pointer;
|
||||
_Thread_queue_Enter_critical_section( &api->Join_List );
|
||||
_Thread_queue_Enqueue( &api->Join_List, WATCHDOG_NO_TIMEOUT );
|
||||
_Thread_queue_Enqueue(
|
||||
&api->Join_List,
|
||||
executing,
|
||||
WATCHDOG_NO_TIMEOUT
|
||||
);
|
||||
}
|
||||
_Objects_Put( &the_thread->Object );
|
||||
|
||||
|
||||
@@ -157,7 +157,7 @@ int sigtimedwait(
|
||||
executing->Wait.return_argument = the_info;
|
||||
_Thread_queue_Enter_critical_section( &_POSIX_signals_Wait_queue );
|
||||
_ISR_Enable( level );
|
||||
_Thread_queue_Enqueue( &_POSIX_signals_Wait_queue, interval );
|
||||
_Thread_queue_Enqueue( &_POSIX_signals_Wait_queue, executing, interval );
|
||||
_Thread_Enable_dispatch();
|
||||
|
||||
/*
|
||||
|
||||
@@ -85,7 +85,11 @@ rtems_status_code rtems_region_get_segment(
|
||||
|
||||
_Thread_queue_Enter_critical_section( &the_region->Wait_queue );
|
||||
|
||||
_Thread_queue_Enqueue( &the_region->Wait_queue, timeout );
|
||||
_Thread_queue_Enqueue(
|
||||
&the_region->Wait_queue,
|
||||
executing,
|
||||
timeout
|
||||
);
|
||||
|
||||
_Objects_Put( &the_region->Object );
|
||||
|
||||
|
||||
@@ -241,7 +241,7 @@ RTEMS_INLINE_ROUTINE void _CORE_semaphore_Seize_isr_disable(
|
||||
executing->Wait.id = id;
|
||||
_ISR_Enable( level );
|
||||
|
||||
_Thread_queue_Enqueue( &the_semaphore->Wait_queue, timeout );
|
||||
_Thread_queue_Enqueue( &the_semaphore->Wait_queue, executing, timeout );
|
||||
_Thread_Enable_dispatch();
|
||||
}
|
||||
|
||||
|
||||
@@ -83,9 +83,10 @@ Thread_Control *_Thread_queue_Dequeue(
|
||||
* This routine enqueues the currently executing thread on
|
||||
* the_thread_queue with an optional timeout.
|
||||
*/
|
||||
#define _Thread_queue_Enqueue( _the_thread_queue, _timeout ) \
|
||||
#define _Thread_queue_Enqueue( _the_thread_queue, _the_thread, _timeout ) \
|
||||
_Thread_queue_Enqueue_with_handler( \
|
||||
_the_thread_queue, \
|
||||
_the_thread, \
|
||||
_timeout, \
|
||||
_Thread_queue_Timeout )
|
||||
|
||||
@@ -96,6 +97,7 @@ Thread_Control *_Thread_queue_Dequeue(
|
||||
* starts a timeout timer.
|
||||
*
|
||||
* @param[in] the_thread_queue pointer to threadq
|
||||
* @param[in] the_thread the thread to enqueue
|
||||
* @param[in] timeout interval to wait
|
||||
*
|
||||
* - INTERRUPT LATENCY:
|
||||
@@ -103,6 +105,7 @@ Thread_Control *_Thread_queue_Dequeue(
|
||||
*/
|
||||
void _Thread_queue_Enqueue_with_handler(
|
||||
Thread_queue_Control *the_thread_queue,
|
||||
Thread_Control *the_thread,
|
||||
Watchdog_Interval timeout,
|
||||
Thread_queue_Timeout_callout handler
|
||||
);
|
||||
|
||||
@@ -51,5 +51,5 @@ void _CORE_barrier_Wait(
|
||||
executing->Wait.id = id;
|
||||
_ISR_Enable( level );
|
||||
|
||||
_Thread_queue_Enqueue( &the_barrier->Wait_queue, timeout );
|
||||
_Thread_queue_Enqueue( &the_barrier->Wait_queue, executing, timeout );
|
||||
}
|
||||
|
||||
@@ -121,5 +121,5 @@ void _CORE_message_queue_Seize(
|
||||
/* Wait.count will be filled in with the message priority */
|
||||
_ISR_Enable( level );
|
||||
|
||||
_Thread_queue_Enqueue( &the_message_queue->Wait_queue, timeout );
|
||||
_Thread_queue_Enqueue( &the_message_queue->Wait_queue, executing, timeout );
|
||||
}
|
||||
|
||||
@@ -130,7 +130,11 @@ CORE_message_queue_Status _CORE_message_queue_Submit(
|
||||
executing->Wait.count = submit_type;
|
||||
_ISR_Enable( level );
|
||||
|
||||
_Thread_queue_Enqueue( &the_message_queue->Wait_queue, timeout );
|
||||
_Thread_queue_Enqueue(
|
||||
&the_message_queue->Wait_queue,
|
||||
executing,
|
||||
timeout
|
||||
);
|
||||
}
|
||||
|
||||
return CORE_MESSAGE_QUEUE_STATUS_UNSATISFIED_WAIT;
|
||||
|
||||
@@ -65,7 +65,7 @@ void _CORE_mutex_Seize_interrupt_blocking(
|
||||
}
|
||||
|
||||
the_mutex->blocked_count++;
|
||||
_Thread_queue_Enqueue( &the_mutex->Wait_queue, timeout );
|
||||
_Thread_queue_Enqueue( &the_mutex->Wait_queue, executing, timeout );
|
||||
|
||||
_Thread_Enable_dispatch();
|
||||
}
|
||||
|
||||
@@ -86,6 +86,7 @@ void _CORE_RWLock_Obtain_for_reading(
|
||||
|
||||
_Thread_queue_Enqueue_with_handler(
|
||||
&the_rwlock->Wait_queue,
|
||||
executing,
|
||||
timeout,
|
||||
_CORE_RWLock_Timeout
|
||||
);
|
||||
|
||||
@@ -76,6 +76,7 @@ void _CORE_RWLock_Obtain_for_writing(
|
||||
|
||||
_Thread_queue_Enqueue_with_handler(
|
||||
&the_rwlock->Wait_queue,
|
||||
executing,
|
||||
timeout,
|
||||
_CORE_RWLock_Timeout
|
||||
);
|
||||
|
||||
@@ -63,6 +63,6 @@ void _CORE_semaphore_Seize(
|
||||
executing->Wait.queue = &the_semaphore->Wait_queue;
|
||||
executing->Wait.id = id;
|
||||
_ISR_Enable( level );
|
||||
_Thread_queue_Enqueue( &the_semaphore->Wait_queue, timeout );
|
||||
_Thread_queue_Enqueue( &the_semaphore->Wait_queue, executing, timeout );
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -190,14 +190,16 @@ uint32_t _MPCI_Send_request_packet (
|
||||
States_Control extra_state
|
||||
)
|
||||
{
|
||||
the_packet->source_tid = _Thread_Executing->Object.id;
|
||||
the_packet->source_priority = _Thread_Executing->current_priority;
|
||||
Thread_Control *executing = _Thread_Executing;
|
||||
|
||||
the_packet->source_tid = executing->Object.id;
|
||||
the_packet->source_priority = executing->current_priority;
|
||||
the_packet->to_convert =
|
||||
( the_packet->to_convert - sizeof(MP_packet_Prefix) ) / sizeof(uint32_t);
|
||||
|
||||
_Thread_Executing->Wait.id = the_packet->id;
|
||||
executing->Wait.id = the_packet->id;
|
||||
|
||||
_Thread_Executing->Wait.queue = &_MPCI_Remote_blocked_threads;
|
||||
executing->Wait.queue = &_MPCI_Remote_blocked_threads;
|
||||
|
||||
_Thread_Disable_dispatch();
|
||||
|
||||
@@ -212,14 +214,18 @@ uint32_t _MPCI_Send_request_packet (
|
||||
if (the_packet->timeout == MPCI_DEFAULT_TIMEOUT)
|
||||
the_packet->timeout = _MPCI_table->default_timeout;
|
||||
|
||||
_Thread_queue_Enqueue( &_MPCI_Remote_blocked_threads, the_packet->timeout );
|
||||
_Thread_queue_Enqueue(
|
||||
&_MPCI_Remote_blocked_threads,
|
||||
executing,
|
||||
the_packet->timeout
|
||||
);
|
||||
|
||||
_Thread_Executing->current_state =
|
||||
_States_Set( extra_state, _Thread_Executing->current_state );
|
||||
executing->current_state =
|
||||
_States_Set( extra_state, executing->current_state );
|
||||
|
||||
_Thread_Enable_dispatch();
|
||||
|
||||
return _Thread_Executing->Wait.return_code;
|
||||
return executing->Wait.return_code;
|
||||
}
|
||||
|
||||
void _MPCI_Send_response_packet (
|
||||
|
||||
@@ -28,11 +28,11 @@
|
||||
|
||||
void _Thread_queue_Enqueue_with_handler(
|
||||
Thread_queue_Control *the_thread_queue,
|
||||
Thread_Control *the_thread,
|
||||
Watchdog_Interval timeout,
|
||||
Thread_queue_Timeout_callout handler
|
||||
)
|
||||
{
|
||||
Thread_Control *the_thread;
|
||||
ISR_Level level;
|
||||
Thread_blocking_operation_States sync_state;
|
||||
Thread_blocking_operation_States (*enqueue_p)(
|
||||
@@ -41,8 +41,6 @@ void _Thread_queue_Enqueue_with_handler(
|
||||
ISR_Level *
|
||||
);
|
||||
|
||||
the_thread = _Thread_Executing;
|
||||
|
||||
#if defined(RTEMS_MULTIPROCESSING)
|
||||
if ( _Thread_MP_Is_receive( the_thread ) && the_thread->receive_packet )
|
||||
the_thread = _Thread_MP_Allocate_proxy( the_thread_queue->state );
|
||||
|
||||
Reference in New Issue
Block a user