Use a parameter for _Thread_queue_Enqueue() instead to reduce memory usage. --- cpukit/libfs/src/pipe/fifo.c | 25 ------------------------- cpukit/posix/src/condinit.c | 1 - cpukit/posix/src/condwaitsupp.c | 9 ++++++++- cpukit/posix/src/psignal.c | 2 -- cpukit/posix/src/pthread.c | 1 - cpukit/posix/src/pthreadjoin.c | 2 ++ cpukit/posix/src/sigtimedwait.c | 7 ++++++- cpukit/rtems/src/regioncreate.c | 2 -- cpukit/rtems/src/regiongetsegment.c | 2 ++ cpukit/score/include/rtems/score/threadq.h | 4 ---- cpukit/score/include/rtems/score/threadqimpl.h | 4 ++-- cpukit/score/src/corebarrier.c | 2 -- cpukit/score/src/corebarrierwait.c | 8 +++++++- cpukit/score/src/coremsg.c | 2 -- cpukit/score/src/coremsgseize.c | 8 +++++++- cpukit/score/src/coremsgsubmit.c | 2 ++ cpukit/score/src/coremutex.c | 1 - cpukit/score/src/coremutexseize.c | 8 +++++++- cpukit/score/src/corerwlock.c | 2 -- cpukit/score/src/corerwlockobtainread.c | 2 ++ cpukit/score/src/corerwlockobtainwrite.c | 2 ++ cpukit/score/src/coresem.c | 2 -- cpukit/score/src/coresemseize.c | 7 ++++++- cpukit/score/src/threadq.c | 2 -- cpukit/score/src/threadqenqueue.c | 5 +++-- 25 files changed, 56 insertions(+), 56 deletions(-)
diff --git a/cpukit/libfs/src/pipe/fifo.c b/cpukit/libfs/src/pipe/fifo.c index 91d95dc..76550dd 100644 --- a/cpukit/libfs/src/pipe/fifo.c +++ b/cpukit/libfs/src/pipe/fifo.c @@ -61,27 +61,6 @@ static rtems_id pipe_semaphore = RTEMS_ID_NONE; #define PIPE_WAKEUPWRITERS(_pipe) \ do {uint32_t n; rtems_barrier_release(_pipe->writeBarrier, &n); } while(0) - -#ifdef RTEMS_POSIX_API -#include <rtems/rtems/barrier.h> -#include <rtems/score/thread.h> - -/* Set barriers to be interruptible by signals. */ -static void pipe_interruptible(pipe_control_t *pipe) -{ - Objects_Locations location; - Barrier_Control *the_barrier; - - the_barrier = _Barrier_Get(pipe->readBarrier, &location); - the_barrier->Barrier.Wait_queue.state |= STATES_INTERRUPTIBLE_BY_SIGNAL; - _Objects_Put( &the_barrier->Object ); - - the_barrier = _Barrier_Get(pipe->writeBarrier, &location); - the_barrier->Barrier.Wait_queue.state |= STATES_INTERRUPTIBLE_BY_SIGNAL; - _Objects_Put( &the_barrier->Object ); -} -#endif - /* * Alloc pipe control structure, buffer, and resources. * Called with pipe_semaphore held. @@ -122,10 +101,6 @@ static int pipe_alloc( RTEMS_NO_PRIORITY, &pipe->Semaphore) != RTEMS_SUCCESSFUL) goto err_sem; -#ifdef RTEMS_POSIX_API - pipe_interruptible(pipe); -#endif - *pipep = pipe; if (c ++ == 'z') c = 'a'; diff --git a/cpukit/posix/src/condinit.c b/cpukit/posix/src/condinit.c index 81575f2..c1c14b8 100644 --- a/cpukit/posix/src/condinit.c +++ b/cpukit/posix/src/condinit.c @@ -65,7 +65,6 @@ int pthread_cond_init( _Thread_queue_Initialize( &the_cond->Wait_queue, THREAD_QUEUE_DISCIPLINE_FIFO, - STATES_WAITING_FOR_CONDITION_VARIABLE | STATES_INTERRUPTIBLE_BY_SIGNAL, ETIMEDOUT ); diff --git a/cpukit/posix/src/condwaitsupp.c b/cpukit/posix/src/condwaitsupp.c index 2a0b57f..1abdc42 100644 --- a/cpukit/posix/src/condwaitsupp.c +++ b/cpukit/posix/src/condwaitsupp.c @@ -23,6 +23,7 @@ #include <rtems/system.h> #include <rtems/score/watchdog.h> +#include <rtems/score/statesimpl.h> #include <rtems/posix/condimpl.h> #include <rtems/posix/time.h> #include <rtems/posix/muteximpl.h> @@ -79,7 +80,13 @@ int _POSIX_Condition_variables_Wait_support( executing->Wait.queue = &the_cond->Wait_queue; executing->Wait.id = *cond; - _Thread_queue_Enqueue( &the_cond->Wait_queue, executing, timeout ); + _Thread_queue_Enqueue( + &the_cond->Wait_queue, + executing, + STATES_WAITING_FOR_CONDITION_VARIABLE + | STATES_INTERRUPTIBLE_BY_SIGNAL, + timeout + ); _Objects_Put( &the_cond->Object ); diff --git a/cpukit/posix/src/psignal.c b/cpukit/posix/src/psignal.c index 0e2a018..eec4d95 100644 --- a/cpukit/posix/src/psignal.c +++ b/cpukit/posix/src/psignal.c @@ -24,7 +24,6 @@ #include <stdlib.h> #include <rtems/score/isrlevel.h> -#include <rtems/score/statesimpl.h> #include <rtems/score/threadimpl.h> #include <rtems/score/threadqimpl.h> #include <rtems/score/watchdogimpl.h> @@ -194,7 +193,6 @@ void _POSIX_signals_Manager_Initialization(void) _Thread_queue_Initialize( &_POSIX_signals_Wait_queue, THREAD_QUEUE_DISCIPLINE_FIFO, - STATES_WAITING_FOR_SIGNAL | STATES_INTERRUPTIBLE_BY_SIGNAL, EAGAIN ); diff --git a/cpukit/posix/src/pthread.c b/cpukit/posix/src/pthread.c index 6b1e555..4d28de5 100644 --- a/cpukit/posix/src/pthread.c +++ b/cpukit/posix/src/pthread.c @@ -238,7 +238,6 @@ static bool _POSIX_Threads_Create_extension( _Thread_queue_Initialize( &api->Join_List, THREAD_QUEUE_DISCIPLINE_FIFO, - STATES_WAITING_FOR_JOIN_AT_EXIT | STATES_INTERRUPTIBLE_BY_SIGNAL, 0 ); diff --git a/cpukit/posix/src/pthreadjoin.c b/cpukit/posix/src/pthreadjoin.c index 136eea6..99cc4d3 100644 --- a/cpukit/posix/src/pthreadjoin.c +++ b/cpukit/posix/src/pthreadjoin.c @@ -26,6 +26,7 @@ #include <rtems/posix/pthreadimpl.h> #include <rtems/score/threadimpl.h> #include <rtems/score/threadqimpl.h> +#include <rtems/score/statesimpl.h> int pthread_join( pthread_t thread, @@ -70,6 +71,7 @@ on_EINTR: _Thread_queue_Enqueue( &api->Join_List, executing, + STATES_WAITING_FOR_JOIN_AT_EXIT | STATES_INTERRUPTIBLE_BY_SIGNAL, WATCHDOG_NO_TIMEOUT ); } diff --git a/cpukit/posix/src/sigtimedwait.c b/cpukit/posix/src/sigtimedwait.c index 4c456dd..8d86ba7 100644 --- a/cpukit/posix/src/sigtimedwait.c +++ b/cpukit/posix/src/sigtimedwait.c @@ -158,7 +158,12 @@ int sigtimedwait( executing->Wait.return_argument = the_info; _Thread_queue_Enter_critical_section( &_POSIX_signals_Wait_queue ); _POSIX_signals_Release( &lock_context ); - _Thread_queue_Enqueue( &_POSIX_signals_Wait_queue, executing, interval ); + _Thread_queue_Enqueue( + &_POSIX_signals_Wait_queue, + executing, + STATES_WAITING_FOR_SIGNAL | STATES_INTERRUPTIBLE_BY_SIGNAL, + interval + ); _Thread_Enable_dispatch(); /* diff --git a/cpukit/rtems/src/regioncreate.c b/cpukit/rtems/src/regioncreate.c index 6c623c8..0daf644 100644 --- a/cpukit/rtems/src/regioncreate.c +++ b/cpukit/rtems/src/regioncreate.c @@ -22,7 +22,6 @@ #include <rtems/rtems/attrimpl.h> #include <rtems/rtems/support.h> #include <rtems/score/apimutex.h> -#include <rtems/score/statesimpl.h> #include <rtems/score/threadqimpl.h> /* @@ -94,7 +93,6 @@ rtems_status_code rtems_region_create( &the_region->Wait_queue, _Attributes_Is_priority( attribute_set ) ? THREAD_QUEUE_DISCIPLINE_PRIORITY : THREAD_QUEUE_DISCIPLINE_FIFO, - STATES_WAITING_FOR_SEGMENT, RTEMS_TIMEOUT ); diff --git a/cpukit/rtems/src/regiongetsegment.c b/cpukit/rtems/src/regiongetsegment.c index 4bd2445..1a52bc1 100644 --- a/cpukit/rtems/src/regiongetsegment.c +++ b/cpukit/rtems/src/regiongetsegment.c @@ -22,6 +22,7 @@ #include <rtems/rtems/optionsimpl.h> #include <rtems/score/apimutex.h> #include <rtems/score/threadqimpl.h> +#include <rtems/score/statesimpl.h> rtems_status_code rtems_region_get_segment( rtems_id id, @@ -88,6 +89,7 @@ rtems_status_code rtems_region_get_segment( _Thread_queue_Enqueue( &the_region->Wait_queue, executing, + STATES_WAITING_FOR_SEGMENT, timeout ); diff --git a/cpukit/score/include/rtems/score/threadq.h b/cpukit/score/include/rtems/score/threadq.h index 6dcdf41..00b9221 100644 --- a/cpukit/score/include/rtems/score/threadq.h +++ b/cpukit/score/include/rtems/score/threadq.h @@ -66,10 +66,6 @@ typedef struct { Thread_blocking_operation_States sync_state; /** This field indicates the thread queue's blocking discipline. */ Thread_queue_Disciplines discipline; - /** This indicates the blocking state for threads waiting on this - * thread queue. - */ - States_Control state; /** This is the status value returned to threads which timeout while * waiting on this thread queue. */ diff --git a/cpukit/score/include/rtems/score/threadqimpl.h b/cpukit/score/include/rtems/score/threadqimpl.h index 57bdf05..c1bd902 100644 --- a/cpukit/score/include/rtems/score/threadqimpl.h +++ b/cpukit/score/include/rtems/score/threadqimpl.h @@ -71,6 +71,7 @@ Thread_Control *_Thread_queue_Dequeue( * * @param[in] the_thread_queue pointer to threadq * @param[in] the_thread the thread to enqueue + * @param[in] state is the new state of the thread * @param[in] timeout interval to wait * * - INTERRUPT LATENCY: @@ -79,6 +80,7 @@ Thread_Control *_Thread_queue_Dequeue( void _Thread_queue_Enqueue( Thread_queue_Control *the_thread_queue, Thread_Control *the_thread, + States_Control state, Watchdog_Interval timeout ); @@ -170,13 +172,11 @@ 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] state is the state of waiting threads * @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, - States_Control state, uint32_t timeout_status ); diff --git a/cpukit/score/src/corebarrier.c b/cpukit/score/src/corebarrier.c index fe2a2e9..2035961 100644 --- a/cpukit/score/src/corebarrier.c +++ b/cpukit/score/src/corebarrier.c @@ -19,7 +19,6 @@ #endif #include <rtems/score/corebarrierimpl.h> -#include <rtems/score/statesimpl.h> #include <rtems/score/threadqimpl.h> void _CORE_barrier_Initialize( @@ -34,7 +33,6 @@ void _CORE_barrier_Initialize( _Thread_queue_Initialize( &the_barrier->Wait_queue, THREAD_QUEUE_DISCIPLINE_FIFO, - STATES_WAITING_FOR_BARRIER, CORE_BARRIER_TIMEOUT ); } diff --git a/cpukit/score/src/corebarrierwait.c b/cpukit/score/src/corebarrierwait.c index 3fedb31..6267ae6 100644 --- a/cpukit/score/src/corebarrierwait.c +++ b/cpukit/score/src/corebarrierwait.c @@ -20,6 +20,7 @@ #include <rtems/score/corebarrierimpl.h> #include <rtems/score/isrlevel.h> +#include <rtems/score/statesimpl.h> #include <rtems/score/threadqimpl.h> void _CORE_barrier_Wait( @@ -51,5 +52,10 @@ void _CORE_barrier_Wait( executing->Wait.id = id; _ISR_Enable( level ); - _Thread_queue_Enqueue( &the_barrier->Wait_queue, executing, timeout ); + _Thread_queue_Enqueue( + &the_barrier->Wait_queue, + executing, + STATES_WAITING_FOR_BARRIER, + timeout + ); } diff --git a/cpukit/score/src/coremsg.c b/cpukit/score/src/coremsg.c index fc1ca45..0790221 100644 --- a/cpukit/score/src/coremsg.c +++ b/cpukit/score/src/coremsg.c @@ -19,7 +19,6 @@ #endif #include <rtems/score/coremsgimpl.h> -#include <rtems/score/statesimpl.h> #include <rtems/score/wkspace.h> /* @@ -113,7 +112,6 @@ bool _CORE_message_queue_Initialize( &the_message_queue->Wait_queue, _CORE_message_queue_Is_priority( the_message_queue_attributes ) ? THREAD_QUEUE_DISCIPLINE_PRIORITY : THREAD_QUEUE_DISCIPLINE_FIFO, - STATES_WAITING_FOR_MESSAGE, CORE_MESSAGE_QUEUE_STATUS_TIMEOUT ); diff --git a/cpukit/score/src/coremsgseize.c b/cpukit/score/src/coremsgseize.c index e4a4270..db8d558 100644 --- a/cpukit/score/src/coremsgseize.c +++ b/cpukit/score/src/coremsgseize.c @@ -23,6 +23,7 @@ #include <rtems/score/isr.h> #include <rtems/score/coremsgimpl.h> #include <rtems/score/thread.h> +#include <rtems/score/statesimpl.h> #include <rtems/score/wkspace.h> void _CORE_message_queue_Seize( @@ -121,5 +122,10 @@ 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, executing, timeout ); + _Thread_queue_Enqueue( + &the_message_queue->Wait_queue, + executing, + STATES_WAITING_FOR_MESSAGE, + timeout + ); } diff --git a/cpukit/score/src/coremsgsubmit.c b/cpukit/score/src/coremsgsubmit.c index 4ee41b8..4437856 100644 --- a/cpukit/score/src/coremsgsubmit.c +++ b/cpukit/score/src/coremsgsubmit.c @@ -22,6 +22,7 @@ #include <rtems/score/coremsgimpl.h> #include <rtems/score/objectimpl.h> #include <rtems/score/isr.h> +#include <rtems/score/statesimpl.h> #include <rtems/score/wkspace.h> CORE_message_queue_Status _CORE_message_queue_Submit( @@ -133,6 +134,7 @@ CORE_message_queue_Status _CORE_message_queue_Submit( _Thread_queue_Enqueue( &the_message_queue->Wait_queue, executing, + STATES_WAITING_FOR_MESSAGE, timeout ); } diff --git a/cpukit/score/src/coremutex.c b/cpukit/score/src/coremutex.c index 949aa70..b5e8a5e 100644 --- a/cpukit/score/src/coremutex.c +++ b/cpukit/score/src/coremutex.c @@ -84,7 +84,6 @@ CORE_mutex_Status _CORE_mutex_Initialize( &the_mutex->Wait_queue, _CORE_mutex_Is_fifo( the_mutex_attributes ) ? THREAD_QUEUE_DISCIPLINE_FIFO : THREAD_QUEUE_DISCIPLINE_PRIORITY, - STATES_WAITING_FOR_MUTEX, CORE_MUTEX_TIMEOUT ); diff --git a/cpukit/score/src/coremutexseize.c b/cpukit/score/src/coremutexseize.c index 2f9c8da..d49b566 100644 --- a/cpukit/score/src/coremutexseize.c +++ b/cpukit/score/src/coremutexseize.c @@ -22,6 +22,7 @@ #include <rtems/score/isr.h> #include <rtems/score/coremuteximpl.h> #include <rtems/score/schedulerimpl.h> +#include <rtems/score/statesimpl.h> #include <rtems/score/thread.h> #if defined(__RTEMS_DO_NOT_INLINE_CORE_MUTEX_SEIZE__) @@ -63,7 +64,12 @@ void _CORE_mutex_Seize_interrupt_blocking( ); } - _Thread_queue_Enqueue( &the_mutex->Wait_queue, executing, timeout ); + _Thread_queue_Enqueue( + &the_mutex->Wait_queue, + executing, + STATES_WAITING_FOR_MUTEX, + timeout + ); _Thread_Enable_dispatch(); } diff --git a/cpukit/score/src/corerwlock.c b/cpukit/score/src/corerwlock.c index 0c66f52..0d47db4 100644 --- a/cpukit/score/src/corerwlock.c +++ b/cpukit/score/src/corerwlock.c @@ -19,7 +19,6 @@ #endif #include <rtems/score/corerwlockimpl.h> -#include <rtems/score/statesimpl.h> #include <rtems/score/threadqimpl.h> void _CORE_RWLock_Initialize( @@ -38,7 +37,6 @@ void _CORE_RWLock_Initialize( _Thread_queue_Initialize( &the_rwlock->Wait_queue, THREAD_QUEUE_DISCIPLINE_FIFO, - STATES_WAITING_FOR_RWLOCK, CORE_RWLOCK_TIMEOUT ); } diff --git a/cpukit/score/src/corerwlockobtainread.c b/cpukit/score/src/corerwlockobtainread.c index f3851b4..203680f 100644 --- a/cpukit/score/src/corerwlockobtainread.c +++ b/cpukit/score/src/corerwlockobtainread.c @@ -20,6 +20,7 @@ #include <rtems/score/corerwlockimpl.h> #include <rtems/score/threadqimpl.h> +#include <rtems/score/statesimpl.h> #include <rtems/score/watchdog.h> void _CORE_RWLock_Obtain_for_reading( @@ -87,6 +88,7 @@ void _CORE_RWLock_Obtain_for_reading( _Thread_queue_Enqueue( &the_rwlock->Wait_queue, executing, + STATES_WAITING_FOR_RWLOCK, timeout ); diff --git a/cpukit/score/src/corerwlockobtainwrite.c b/cpukit/score/src/corerwlockobtainwrite.c index ea7d25c..3499bcd 100644 --- a/cpukit/score/src/corerwlockobtainwrite.c +++ b/cpukit/score/src/corerwlockobtainwrite.c @@ -20,6 +20,7 @@ #include <rtems/score/corerwlockimpl.h> #include <rtems/score/threadqimpl.h> +#include <rtems/score/statesimpl.h> #include <rtems/score/watchdog.h> void _CORE_RWLock_Obtain_for_writing( @@ -77,6 +78,7 @@ void _CORE_RWLock_Obtain_for_writing( _Thread_queue_Enqueue( &the_rwlock->Wait_queue, executing, + STATES_WAITING_FOR_RWLOCK, timeout ); diff --git a/cpukit/score/src/coresem.c b/cpukit/score/src/coresem.c index 32b3458..eb1ba7e 100644 --- a/cpukit/score/src/coresem.c +++ b/cpukit/score/src/coresem.c @@ -19,7 +19,6 @@ #endif #include <rtems/score/coresemimpl.h> -#include <rtems/score/statesimpl.h> void _CORE_semaphore_Initialize( CORE_semaphore_Control *the_semaphore, @@ -35,7 +34,6 @@ void _CORE_semaphore_Initialize( &the_semaphore->Wait_queue, _CORE_semaphore_Is_priority( the_semaphore_attributes ) ? THREAD_QUEUE_DISCIPLINE_PRIORITY : THREAD_QUEUE_DISCIPLINE_FIFO, - STATES_WAITING_FOR_SEMAPHORE, CORE_SEMAPHORE_TIMEOUT ); } diff --git a/cpukit/score/src/coresemseize.c b/cpukit/score/src/coresemseize.c index d991af6..9c0db96 100644 --- a/cpukit/score/src/coresemseize.c +++ b/cpukit/score/src/coresemseize.c @@ -63,6 +63,11 @@ 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, executing, timeout ); + _Thread_queue_Enqueue( + &the_semaphore->Wait_queue, + executing, + STATES_WAITING_FOR_SEMAPHORE, + timeout + ); } #endif diff --git a/cpukit/score/src/threadq.c b/cpukit/score/src/threadq.c index 1f416ba..bdd380d 100644 --- a/cpukit/score/src/threadq.c +++ b/cpukit/score/src/threadq.c @@ -47,11 +47,9 @@ RBTree_Compare_result _Thread_queue_Compare_priority( void _Thread_queue_Initialize( Thread_queue_Control *the_thread_queue, Thread_queue_Disciplines the_discipline, - States_Control state, uint32_t timeout_status ) { - the_thread_queue->state = state; the_thread_queue->discipline = the_discipline; the_thread_queue->timeout_status = timeout_status; the_thread_queue->sync_state = THREAD_BLOCKING_OPERATION_SYNCHRONIZED; diff --git a/cpukit/score/src/threadqenqueue.c b/cpukit/score/src/threadqenqueue.c index 9048551..5c23756 100644 --- a/cpukit/score/src/threadqenqueue.c +++ b/cpukit/score/src/threadqenqueue.c @@ -104,6 +104,7 @@ static void _Thread_queue_Requeue_priority( void _Thread_queue_Enqueue( Thread_queue_Control *the_thread_queue, Thread_Control *the_thread, + States_Control state, Watchdog_Interval timeout ) { @@ -112,13 +113,13 @@ void _Thread_queue_Enqueue( #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 ); + the_thread = _Thread_MP_Allocate_proxy( state ); else #endif /* * Set the blocking state for this thread queue in the thread. */ - _Thread_Set_state( the_thread, the_thread_queue->state ); + _Thread_Set_state( the_thread, state ); /* * If the thread wants to timeout, then schedule its timer. -- 2.1.4 _______________________________________________ devel mailing list devel@rtems.org http://lists.rtems.org/mailman/listinfo/devel