score: Delete Thread_queue_Control::timeout_status

Use a parameter for _Thread_queue_Enqueue() instead to reduce memory
usage.
This commit is contained in:
Sebastian Huber
2015-04-27 16:25:52 +02:00
parent cc366ec8c9
commit f5d6c8b58d
34 changed files with 60 additions and 57 deletions

View File

@@ -64,8 +64,7 @@ int pthread_cond_init(
_Thread_queue_Initialize(
&the_cond->Wait_queue,
THREAD_QUEUE_DISCIPLINE_FIFO,
ETIMEDOUT
THREAD_QUEUE_DISCIPLINE_FIFO
);
_Objects_Open_u32(

View File

@@ -83,7 +83,8 @@ int _POSIX_Condition_variables_Wait_support(
executing,
STATES_WAITING_FOR_CONDITION_VARIABLE
| STATES_INTERRUPTIBLE_BY_SIGNAL,
timeout
timeout,
ETIMEDOUT
);
_Objects_Put( &the_cond->Object );

View File

@@ -190,8 +190,7 @@ void _POSIX_signals_Manager_Initialization(void)
*/
_Thread_queue_Initialize(
&_POSIX_signals_Wait_queue,
THREAD_QUEUE_DISCIPLINE_FIFO,
EAGAIN
THREAD_QUEUE_DISCIPLINE_FIFO
);
/* XXX status codes */

View File

@@ -235,11 +235,7 @@ static bool _POSIX_Threads_Create_extension(
_POSIX_signals_Action_handler
);
_Thread_queue_Initialize(
&api->Join_List,
THREAD_QUEUE_DISCIPLINE_FIFO,
0
);
_Thread_queue_Initialize( &api->Join_List, THREAD_QUEUE_DISCIPLINE_FIFO );
_Watchdog_Initialize(
&api->Sporadic_timer,

View File

@@ -71,7 +71,8 @@ on_EINTR:
&api->Join_List,
executing,
STATES_WAITING_FOR_JOIN | STATES_INTERRUPTIBLE_BY_SIGNAL,
WATCHDOG_NO_TIMEOUT
WATCHDOG_NO_TIMEOUT,
0
);
}
_Objects_Put( &the_thread->Object );

View File

@@ -160,6 +160,7 @@ int sigtimedwait(
executing,
STATES_WAITING_FOR_SIGNAL | STATES_INTERRUPTIBLE_BY_SIGNAL,
interval,
EAGAIN,
&lock_context
);
_Thread_Enable_dispatch();

View File

@@ -59,7 +59,8 @@ rtems_status_code _Event_MP_Send_request_packet (
_MPCI_Send_request_packet(
_Objects_Get_node( event_id ),
&the_packet->Prefix,
STATES_READY
STATES_READY,
RTEMS_TIMEOUT
);
break;

View File

@@ -148,7 +148,8 @@ rtems_status_code _Message_queue_MP_Send_request_packet (
return (rtems_status_code) _MPCI_Send_request_packet(
_Objects_Get_node(message_queue_id),
&the_packet->Prefix,
STATES_WAITING_FOR_MESSAGE
STATES_WAITING_FOR_MESSAGE,
RTEMS_TIMEOUT
);
break;
@@ -173,7 +174,8 @@ rtems_status_code _Message_queue_MP_Send_request_packet (
return (rtems_status_code) _MPCI_Send_request_packet(
_Objects_Get_node(message_queue_id),
&the_packet->Prefix,
STATES_WAITING_FOR_MESSAGE
STATES_WAITING_FOR_MESSAGE,
RTEMS_TIMEOUT
);
break;

View File

@@ -104,7 +104,8 @@ rtems_status_code _Partition_MP_Send_request_packet (
_MPCI_Send_request_packet(
_Objects_Get_node( partition_id ),
&the_packet->Prefix,
STATES_READY /* Not used */
STATES_READY, /* Not used */
RTEMS_TIMEOUT
);
break;

View File

@@ -74,8 +74,7 @@ rtems_status_code rtems_region_create(
_Thread_queue_Initialize(
&the_region->Wait_queue,
_Attributes_Is_priority( attribute_set ) ?
THREAD_QUEUE_DISCIPLINE_PRIORITY : THREAD_QUEUE_DISCIPLINE_FIFO,
RTEMS_TIMEOUT
THREAD_QUEUE_DISCIPLINE_PRIORITY : THREAD_QUEUE_DISCIPLINE_FIFO
);
the_region->maximum_segment_size = _Heap_Initialize(

View File

@@ -87,7 +87,8 @@ rtems_status_code rtems_region_get_segment(
&the_region->Wait_queue,
executing,
STATES_WAITING_FOR_SEGMENT,
timeout
timeout,
RTEMS_TIMEOUT
);
_Objects_Put( &the_region->Object );

View File

@@ -102,7 +102,8 @@ rtems_status_code _Region_MP_Send_request_packet (
return (rtems_status_code) _MPCI_Send_request_packet(
_Objects_Get_node( region_id ),
&the_packet->Prefix,
STATES_READY /* Not used */
STATES_READY, /* Not used */
RTEMS_TIMEOUT
);
break;

View File

@@ -95,7 +95,8 @@ rtems_status_code _Semaphore_MP_Send_request_packet (
return _MPCI_Send_request_packet(
_Objects_Get_node( semaphore_id ),
&the_packet->Prefix,
STATES_WAITING_FOR_SEMAPHORE
STATES_WAITING_FOR_SEMAPHORE,
RTEMS_TIMEOUT
);
break;

View File

@@ -60,7 +60,8 @@ rtems_status_code _Signal_MP_Send_request_packet (
return _MPCI_Send_request_packet(
_Objects_Get_node( task_id ),
&the_packet->Prefix,
STATES_READY /* Not used */
STATES_READY, /* Not used */
RTEMS_TIMEOUT
);
break;

View File

@@ -108,7 +108,8 @@ rtems_status_code _RTEMS_tasks_MP_Send_request_packet (
return _MPCI_Send_request_packet(
_Objects_Get_node( task_id ),
&the_packet->Prefix,
STATES_READY /* Not used */
STATES_READY, /* Not used */
RTEMS_TIMEOUT
);
break;

View File

@@ -248,6 +248,7 @@ RTEMS_INLINE_ROUTINE void _CORE_semaphore_Seize_isr_disable(
executing,
STATES_WAITING_FOR_SEMAPHORE,
timeout,
CORE_SEMAPHORE_TIMEOUT,
lock_context
);
_Thread_Enable_dispatch();

View File

@@ -189,13 +189,15 @@ void _MPCI_Send_process_packet (
* set in addition to the remote operation pending state. It
* may indicate the caller is blocking on a message queue
* operation.
* @param[in] timeout_code is the timeout code
*
* @retval This method returns the operation status from the remote node.
*/
uint32_t _MPCI_Send_request_packet (
uint32_t destination,
MP_packet_Prefix *the_packet,
States_Control extra_state
States_Control extra_state,
uint32_t timeout_code
);
/**

View File

@@ -194,11 +194,6 @@ struct Thread_queue_Control {
* _Thread_queue_Release().
*/
ISR_LOCK_MEMBER( Lock )
/** This is the status value returned to threads which timeout while
* waiting on this thread queue.
*/
uint32_t timeout_status;
};
/**@}*/

View File

@@ -134,6 +134,7 @@ Thread_Control *_Thread_queue_Dequeue(
* @param[in] state The new state of the thread.
* @param[in] timeout Interval to wait. Use WATCHDOG_NO_TIMEOUT to block
* potentially forever.
* @param[in] timeout_code The return code in case a timeout occurs.
* @param[in] lock_context The lock context of the lock acquire.
*/
void _Thread_queue_Enqueue_critical(
@@ -141,6 +142,7 @@ void _Thread_queue_Enqueue_critical(
Thread_Control *the_thread,
States_Control state,
Watchdog_Interval timeout,
uint32_t timeout_code,
ISR_lock_Context *lock_context
);
@@ -152,7 +154,8 @@ RTEMS_INLINE_ROUTINE void _Thread_queue_Enqueue(
Thread_queue_Control *the_thread_queue,
Thread_Control *the_thread,
States_Control state,
Watchdog_Interval timeout
Watchdog_Interval timeout,
uint32_t timeout_code
)
{
ISR_lock_Context lock_context;
@@ -163,6 +166,7 @@ RTEMS_INLINE_ROUTINE void _Thread_queue_Enqueue(
the_thread,
state,
timeout,
timeout_code,
&lock_context
);
}
@@ -332,12 +336,10 @@ void _Thread_queue_Flush(
*
* @param[in] the_thread_queue is the pointer to a threadq header
* @param[in] the_discipline is the queueing discipline
* @param[in] timeout_status is the return on a timeout
*/
void _Thread_queue_Initialize(
Thread_queue_Control *the_thread_queue,
Thread_queue_Disciplines the_discipline,
uint32_t timeout_status
Thread_queue_Control *the_thread_queue,
Thread_queue_Disciplines the_discipline
);
RTEMS_INLINE_ROUTINE void _Thread_queue_Destroy(

View File

@@ -32,7 +32,6 @@ void _CORE_barrier_Initialize(
_Thread_queue_Initialize(
&the_barrier->Wait_queue,
THREAD_QUEUE_DISCIPLINE_FIFO,
CORE_BARRIER_TIMEOUT
THREAD_QUEUE_DISCIPLINE_FIFO
);
}

View File

@@ -54,6 +54,7 @@ void _CORE_barrier_Wait(
executing,
STATES_WAITING_FOR_BARRIER,
timeout,
CORE_BARRIER_TIMEOUT,
&lock_context
);
}

View File

@@ -111,8 +111,7 @@ bool _CORE_message_queue_Initialize(
_Thread_queue_Initialize(
&the_message_queue->Wait_queue,
_CORE_message_queue_Is_priority( the_message_queue_attributes ) ?
THREAD_QUEUE_DISCIPLINE_PRIORITY : THREAD_QUEUE_DISCIPLINE_FIFO,
CORE_MESSAGE_QUEUE_STATUS_TIMEOUT
THREAD_QUEUE_DISCIPLINE_PRIORITY : THREAD_QUEUE_DISCIPLINE_FIFO
);
return true;

View File

@@ -124,6 +124,7 @@ void _CORE_message_queue_Seize(
executing,
STATES_WAITING_FOR_MESSAGE,
timeout,
CORE_MESSAGE_QUEUE_STATUS_TIMEOUT,
&lock_context
);
}

View File

@@ -129,7 +129,8 @@ CORE_message_queue_Status _CORE_message_queue_Submit(
&the_message_queue->Wait_queue,
executing,
STATES_WAITING_FOR_MESSAGE,
timeout
timeout,
CORE_MESSAGE_QUEUE_STATUS_TIMEOUT
);
}

View File

@@ -83,8 +83,7 @@ CORE_mutex_Status _CORE_mutex_Initialize(
_Thread_queue_Initialize(
&the_mutex->Wait_queue,
_CORE_mutex_Is_fifo( the_mutex_attributes ) ?
THREAD_QUEUE_DISCIPLINE_FIFO : THREAD_QUEUE_DISCIPLINE_PRIORITY,
CORE_MUTEX_TIMEOUT
THREAD_QUEUE_DISCIPLINE_FIFO : THREAD_QUEUE_DISCIPLINE_PRIORITY
);
return CORE_MUTEX_STATUS_SUCCESSFUL;

View File

@@ -81,6 +81,7 @@ void _CORE_mutex_Seize_interrupt_blocking(
executing,
STATES_WAITING_FOR_MUTEX,
timeout,
CORE_MUTEX_TIMEOUT,
lock_context
);

View File

@@ -36,7 +36,6 @@ void _CORE_RWLock_Initialize(
_Thread_queue_Initialize(
&the_rwlock->Wait_queue,
THREAD_QUEUE_DISCIPLINE_FIFO,
CORE_RWLOCK_TIMEOUT
THREAD_QUEUE_DISCIPLINE_FIFO
);
}

View File

@@ -87,6 +87,7 @@ void _CORE_RWLock_Obtain_for_reading(
executing,
STATES_WAITING_FOR_RWLOCK,
timeout,
CORE_RWLOCK_TIMEOUT,
&lock_context
);

View File

@@ -77,6 +77,7 @@ void _CORE_RWLock_Obtain_for_writing(
executing,
STATES_WAITING_FOR_RWLOCK,
timeout,
CORE_RWLOCK_TIMEOUT,
&lock_context
);

View File

@@ -33,7 +33,6 @@ void _CORE_semaphore_Initialize(
_Thread_queue_Initialize(
&the_semaphore->Wait_queue,
_CORE_semaphore_Is_priority( the_semaphore_attributes ) ?
THREAD_QUEUE_DISCIPLINE_PRIORITY : THREAD_QUEUE_DISCIPLINE_FIFO,
CORE_SEMAPHORE_TIMEOUT
THREAD_QUEUE_DISCIPLINE_PRIORITY : THREAD_QUEUE_DISCIPLINE_FIFO
);
}

View File

@@ -65,6 +65,7 @@ void _CORE_semaphore_Seize(
executing,
STATES_WAITING_FOR_SEMAPHORE,
timeout,
CORE_SEMAPHORE_TIMEOUT,
&lock_context
);
}

View File

@@ -82,8 +82,7 @@ void _MPCI_Handler_initialization(
_Thread_queue_Initialize(
&_MPCI_Remote_blocked_threads,
THREAD_QUEUE_DISCIPLINE_FIFO,
timeout_status
THREAD_QUEUE_DISCIPLINE_FIFO
);
}
@@ -188,7 +187,8 @@ void _MPCI_Send_process_packet (
uint32_t _MPCI_Send_request_packet (
uint32_t destination,
MP_packet_Prefix *the_packet,
States_Control extra_state
States_Control extra_state,
uint32_t timeout_code
)
{
Thread_Control *executing = _Thread_Executing;
@@ -217,7 +217,8 @@ uint32_t _MPCI_Send_request_packet (
&_MPCI_Remote_blocked_threads,
executing,
STATES_WAITING_FOR_RPC_REPLY | extra_state,
the_packet->timeout
the_packet->timeout,
timeout_code
);
_Thread_Enable_dispatch();

View File

@@ -44,15 +44,12 @@ RBTree_Compare_result _Thread_queue_Compare_priority(
}
void _Thread_queue_Initialize(
Thread_queue_Control *the_thread_queue,
Thread_queue_Disciplines the_discipline,
uint32_t timeout_status
Thread_queue_Control *the_thread_queue,
Thread_queue_Disciplines the_discipline
)
{
const Thread_queue_Operations *operations;
the_thread_queue->timeout_status = timeout_status;
_ISR_lock_Initialize( &the_thread_queue->Lock, "Thread Queue" );
if ( the_discipline == THREAD_QUEUE_DISCIPLINE_PRIORITY ) {

View File

@@ -50,6 +50,7 @@ void _Thread_queue_Enqueue_critical(
Thread_Control *the_thread,
States_Control state,
Watchdog_Interval timeout,
uint32_t timeout_code,
ISR_lock_Context *lock_context
)
{
@@ -83,10 +84,7 @@ void _Thread_queue_Enqueue_critical(
* If the thread wants to timeout, then schedule its timer.
*/
if ( timeout != WATCHDOG_NO_TIMEOUT ) {
_Thread_Wait_set_timeout_code(
the_thread,
the_thread_queue->timeout_status
);
_Thread_Wait_set_timeout_code( the_thread, timeout_code );
_Watchdog_Initialize( &the_thread->Timer, _Thread_Timeout, 0, the_thread );
_Watchdog_Insert_ticks( &the_thread->Timer, timeout );
}