diff options
Diffstat (limited to 'cpukit/score/src')
-rw-r--r-- | cpukit/score/src/corebarrierwait.c | 3 | ||||
-rw-r--r-- | cpukit/score/src/coremsgseize.c | 6 | ||||
-rw-r--r-- | cpukit/score/src/coremsgsubmit.c | 3 | ||||
-rw-r--r-- | cpukit/score/src/coremutexseize.c | 3 | ||||
-rw-r--r-- | cpukit/score/src/coremutexsurrender.c | 8 | ||||
-rw-r--r-- | cpukit/score/src/corerwlockobtainread.c | 3 | ||||
-rw-r--r-- | cpukit/score/src/corerwlockobtainwrite.c | 3 | ||||
-rw-r--r-- | cpukit/score/src/threadq.c | 4 | ||||
-rw-r--r-- | cpukit/score/src/threadqenqueue.c | 85 | ||||
-rw-r--r-- | cpukit/score/src/threadqflush.c | 3 | ||||
-rw-r--r-- | cpukit/score/src/threadqops.c | 58 |
11 files changed, 101 insertions, 78 deletions
diff --git a/cpukit/score/src/corebarrierwait.c b/cpukit/score/src/corebarrierwait.c index 39687d31da..b7f424d03d 100644 --- a/cpukit/score/src/corebarrierwait.c +++ b/cpukit/score/src/corebarrierwait.c @@ -50,7 +50,8 @@ void _CORE_barrier_Wait( executing->Wait.id = id; _Thread_queue_Enqueue_critical( - &the_barrier->Wait_queue, + &the_barrier->Wait_queue.Queue, + the_barrier->Wait_queue.operations, executing, STATES_WAITING_FOR_BARRIER, timeout, diff --git a/cpukit/score/src/coremsgseize.c b/cpukit/score/src/coremsgseize.c index 0d1c36fe47..b6ba8e9e32 100644 --- a/cpukit/score/src/coremsgseize.c +++ b/cpukit/score/src/coremsgseize.c @@ -107,7 +107,8 @@ void _CORE_message_queue_Seize( _CORE_message_queue_Get_message_priority( the_message ) ); _Thread_queue_Extract_critical( - &the_message_queue->Wait_queue, + &the_message_queue->Wait_queue.Queue, + the_message_queue->Wait_queue.operations, the_thread, lock_context ); @@ -131,7 +132,8 @@ void _CORE_message_queue_Seize( /* Wait.count will be filled in with the message priority */ _Thread_queue_Enqueue_critical( - &the_message_queue->Wait_queue, + &the_message_queue->Wait_queue.Queue, + the_message_queue->Wait_queue.operations, executing, STATES_WAITING_FOR_MESSAGE, timeout, diff --git a/cpukit/score/src/coremsgsubmit.c b/cpukit/score/src/coremsgsubmit.c index 37f857917c..351c76b750 100644 --- a/cpukit/score/src/coremsgsubmit.c +++ b/cpukit/score/src/coremsgsubmit.c @@ -132,7 +132,8 @@ CORE_message_queue_Status _CORE_message_queue_Submit( executing->Wait.count = submit_type; _Thread_queue_Enqueue_critical( - &the_message_queue->Wait_queue, + &the_message_queue->Wait_queue.Queue, + the_message_queue->Wait_queue.operations, executing, STATES_WAITING_FOR_MESSAGE, timeout, diff --git a/cpukit/score/src/coremutexseize.c b/cpukit/score/src/coremutexseize.c index d5f85c5fad..ddc5d6b982 100644 --- a/cpukit/score/src/coremutexseize.c +++ b/cpukit/score/src/coremutexseize.c @@ -83,7 +83,8 @@ void _CORE_mutex_Seize_interrupt_blocking( } _Thread_queue_Enqueue_critical( - &the_mutex->Wait_queue, + &the_mutex->Wait_queue.Queue, + the_mutex->Wait_queue.operations, executing, STATES_WAITING_FOR_MUTEX, timeout, diff --git a/cpukit/score/src/coremutexsurrender.c b/cpukit/score/src/coremutexsurrender.c index d5dde1e8e6..e3f0d6f2e4 100644 --- a/cpukit/score/src/coremutexsurrender.c +++ b/cpukit/score/src/coremutexsurrender.c @@ -185,7 +185,11 @@ CORE_mutex_Status _CORE_mutex_Surrender( * _Thread_Change_priority() below due to a recursive thread queue lock * acquire. */ - _Thread_queue_Extract_locked( &the_mutex->Wait_queue, the_thread ); + _Thread_queue_Extract_locked( + &the_mutex->Wait_queue.Queue, + the_mutex->Wait_queue.operations, + the_thread + ); #if defined(RTEMS_MULTIPROCESSING) _Thread_Dispatch_disable(); @@ -216,7 +220,7 @@ CORE_mutex_Status _CORE_mutex_Surrender( } _Thread_queue_Unblock_critical( - &the_mutex->Wait_queue, + &the_mutex->Wait_queue.Queue, the_thread, lock_context ); diff --git a/cpukit/score/src/corerwlockobtainread.c b/cpukit/score/src/corerwlockobtainread.c index 0dea50f1e8..73ebddf2df 100644 --- a/cpukit/score/src/corerwlockobtainread.c +++ b/cpukit/score/src/corerwlockobtainread.c @@ -83,7 +83,8 @@ void _CORE_RWLock_Obtain_for_reading( executing->Wait.return_code = CORE_RWLOCK_SUCCESSFUL; _Thread_queue_Enqueue_critical( - &the_rwlock->Wait_queue, + &the_rwlock->Wait_queue.Queue, + the_rwlock->Wait_queue.operations, executing, STATES_WAITING_FOR_RWLOCK, timeout, diff --git a/cpukit/score/src/corerwlockobtainwrite.c b/cpukit/score/src/corerwlockobtainwrite.c index 76dfae2776..b5b31dcf27 100644 --- a/cpukit/score/src/corerwlockobtainwrite.c +++ b/cpukit/score/src/corerwlockobtainwrite.c @@ -73,7 +73,8 @@ void _CORE_RWLock_Obtain_for_writing( executing->Wait.return_code = CORE_RWLOCK_SUCCESSFUL; _Thread_queue_Enqueue_critical( - &the_rwlock->Wait_queue, + &the_rwlock->Wait_queue.Queue, + the_rwlock->Wait_queue.operations, executing, STATES_WAITING_FOR_RWLOCK, timeout, diff --git a/cpukit/score/src/threadq.c b/cpukit/score/src/threadq.c index 3b1b47bf3a..fc5060119b 100644 --- a/cpukit/score/src/threadq.c +++ b/cpukit/score/src/threadq.c @@ -50,7 +50,7 @@ void _Thread_queue_Initialize( { const Thread_queue_Operations *operations; - _ISR_lock_Initialize( &the_thread_queue->Lock, "Thread Queue" ); + _ISR_lock_Initialize( &the_thread_queue->Queue.Lock, "Thread Queue" ); if ( the_discipline == THREAD_QUEUE_DISCIPLINE_PRIORITY ) { operations = &_Thread_queue_Operations_priority; @@ -60,5 +60,5 @@ void _Thread_queue_Initialize( } the_thread_queue->operations = operations; - ( *operations->initialize )( the_thread_queue ); + ( *operations->initialize )( &the_thread_queue->Queue ); } diff --git a/cpukit/score/src/threadqenqueue.c b/cpukit/score/src/threadqenqueue.c index f73fa01173..5ed01b7a95 100644 --- a/cpukit/score/src/threadqenqueue.c +++ b/cpukit/score/src/threadqenqueue.c @@ -46,29 +46,28 @@ static void _Thread_queue_Unblock( Thread_Control *the_thread ) } void _Thread_queue_Enqueue_critical( - Thread_queue_Control *the_thread_queue, - Thread_Control *the_thread, - States_Control state, - Watchdog_Interval timeout, - uint32_t timeout_code, - ISR_lock_Context *lock_context + Thread_queue_Queue *queue, + const Thread_queue_Operations *operations, + Thread_Control *the_thread, + States_Control state, + Watchdog_Interval timeout, + uint32_t timeout_code, + ISR_lock_Context *lock_context ) { - const Thread_queue_Operations *operations; - Per_CPU_Control *cpu_self; - bool success; + Per_CPU_Control *cpu_self; + bool success; - _Thread_Lock_set( the_thread, &the_thread_queue->Lock ); + _Thread_Lock_set( the_thread, &queue->Lock ); - operations = the_thread_queue->operations; - _Thread_Wait_set_queue( the_thread, the_thread_queue ); + _Thread_Wait_set_queue( the_thread, queue ); _Thread_Wait_set_operations( the_thread, operations ); - ( *operations->enqueue )( the_thread_queue, the_thread ); + ( *operations->enqueue )( queue, the_thread ); _Thread_Wait_flags_set( the_thread, THREAD_QUEUE_INTEND_TO_BLOCK ); cpu_self = _Thread_Dispatch_disable_critical( lock_context ); - _Thread_queue_Release( the_thread_queue, lock_context ); + _Thread_queue_Queue_release( queue, lock_context ); #if defined(RTEMS_MULTIPROCESSING) if ( _Thread_MP_Is_receive( the_thread ) && the_thread->receive_packet ) @@ -102,11 +101,12 @@ void _Thread_queue_Enqueue_critical( } void _Thread_queue_Extract_locked( - Thread_queue_Control *the_thread_queue, - Thread_Control *the_thread + Thread_queue_Queue *queue, + const Thread_queue_Operations *operations, + Thread_Control *the_thread ) { - ( *the_thread_queue->operations->extract )( the_thread_queue, the_thread ); + ( *operations->extract )( queue, the_thread ); _Thread_Wait_set_queue( the_thread, NULL ); _Thread_Wait_restore_default_operations( the_thread ); @@ -114,9 +114,9 @@ void _Thread_queue_Extract_locked( } void _Thread_queue_Unblock_critical( - Thread_queue_Control *the_thread_queue, - Thread_Control *the_thread, - ISR_lock_Context *lock_context + Thread_queue_Queue *queue, + Thread_Control *the_thread, + ISR_lock_Context *lock_context ) { bool success; @@ -139,40 +139,46 @@ void _Thread_queue_Unblock_critical( Per_CPU_Control *cpu_self; cpu_self = _Thread_Dispatch_disable_critical( lock_context ); - _Thread_queue_Release( the_thread_queue, lock_context ); + _Thread_queue_Queue_release( queue, lock_context ); _Thread_queue_Unblock( the_thread ); _Thread_Dispatch_enable( cpu_self ); } else { - _Thread_queue_Release( the_thread_queue, lock_context ); + _Thread_queue_Queue_release( queue, lock_context ); } } void _Thread_queue_Extract_critical( - Thread_queue_Control *the_thread_queue, - Thread_Control *the_thread, - ISR_lock_Context *lock_context + Thread_queue_Queue *queue, + const Thread_queue_Operations *operations, + Thread_Control *the_thread, + ISR_lock_Context *lock_context ) { - _Thread_queue_Extract_locked( the_thread_queue, the_thread ); - _Thread_queue_Unblock_critical( the_thread_queue, the_thread, lock_context ); + _Thread_queue_Extract_locked( queue, operations, the_thread ); + _Thread_queue_Unblock_critical( queue, the_thread, lock_context ); } void _Thread_queue_Extract( Thread_Control *the_thread ) { - ISR_lock_Context lock_context; - ISR_lock_Control *lock; - Thread_queue_Control *the_thread_queue; + ISR_lock_Context lock_context; + ISR_lock_Control *lock; + Thread_queue_Queue *queue; lock = _Thread_Lock_acquire( the_thread, &lock_context ); - the_thread_queue = the_thread->Wait.queue; + queue = the_thread->Wait.queue; - if ( the_thread_queue != NULL ) { - _SMP_Assert( lock == &the_thread_queue->Lock ); + if ( queue != NULL ) { + _SMP_Assert( lock == &queue->Lock ); - _Thread_queue_Extract_critical( the_thread_queue, the_thread, &lock_context ); + _Thread_queue_Extract_critical( + queue, + the_thread->Wait.operations, + the_thread, + &lock_context + ); } else { _Thread_Lock_release( lock, &lock_context ); } @@ -188,9 +194,14 @@ Thread_Control *_Thread_queue_Dequeue( Thread_queue_Control *the_thread_queue ) the_thread = _Thread_queue_First_locked( the_thread_queue ); if ( the_thread != NULL ) { - _SMP_Assert( the_thread->Lock.current == &the_thread_queue->Lock ); - - _Thread_queue_Extract_critical( the_thread_queue, the_thread, &lock_context ); + _SMP_Assert( the_thread->Lock.current == &the_thread_queue->Queue.Lock ); + + _Thread_queue_Extract_critical( + &the_thread_queue->Queue, + the_thread_queue->operations, + the_thread, + &lock_context + ); } else { _Thread_queue_Release( the_thread_queue, &lock_context ); } diff --git a/cpukit/score/src/threadqflush.c b/cpukit/score/src/threadqflush.c index d37b9e8ae7..530941b13b 100644 --- a/cpukit/score/src/threadqflush.c +++ b/cpukit/score/src/threadqflush.c @@ -43,7 +43,8 @@ void _Thread_queue_Flush( the_thread->Wait.return_code = status; _Thread_queue_Extract_critical( - the_thread_queue, + &the_thread_queue->Queue, + the_thread_queue->operations, the_thread, &lock_context ); diff --git a/cpukit/score/src/threadqops.c b/cpukit/score/src/threadqops.c index 2967a0efc3..e0be4918b6 100644 --- a/cpukit/score/src/threadqops.c +++ b/cpukit/score/src/threadqops.c @@ -21,70 +21,70 @@ #include <rtems/score/rbtreeimpl.h> static void _Thread_queue_Do_nothing_priority_change( - Thread_Control *the_thread, - Priority_Control new_priority, - Thread_queue_Control *the_thread_queue + Thread_Control *the_thread, + Priority_Control new_priority, + Thread_queue_Queue *queue ) { /* Do nothing */ } static void _Thread_queue_Do_nothing_extract( - Thread_queue_Control *the_thread_queue, - Thread_Control *the_thread + Thread_queue_Queue *queue, + Thread_Control *the_thread ) { /* Do nothing */ } static void _Thread_queue_FIFO_initialize( - Thread_queue_Control *the_thread_queue + Thread_queue_Queue *queue ) { - _Chain_Initialize_empty( &the_thread_queue->Queues.Fifo ); + _Chain_Initialize_empty( &queue->Heads.Fifo ); } static void _Thread_queue_FIFO_enqueue( - Thread_queue_Control *the_thread_queue, - Thread_Control *the_thread + Thread_queue_Queue *queue, + Thread_Control *the_thread ) { _Chain_Append_unprotected( - &the_thread_queue->Queues.Fifo, + &queue->Heads.Fifo, &the_thread->Wait.Node.Chain ); } static void _Thread_queue_FIFO_extract( - Thread_queue_Control *the_thread_queue, - Thread_Control *the_thread + Thread_queue_Queue *queue, + Thread_Control *the_thread ) { _Chain_Extract_unprotected( &the_thread->Wait.Node.Chain ); } static Thread_Control *_Thread_queue_FIFO_first( - Thread_queue_Control *the_thread_queue + Thread_queue_Queue *queue ) { - Chain_Control *fifo = &the_thread_queue->Queues.Fifo; + Chain_Control *fifo = &queue->Heads.Fifo; return _Chain_Is_empty( fifo ) ? NULL : THREAD_CHAIN_NODE_TO_THREAD( _Chain_First( fifo ) ); } static void _Thread_queue_Priority_priority_change( - Thread_Control *the_thread, - Priority_Control new_priority, - Thread_queue_Control *the_thread_queue + Thread_Control *the_thread, + Priority_Control new_priority, + Thread_queue_Queue *queue ) { _RBTree_Extract( - &the_thread_queue->Queues.Priority, + &queue->Heads.Priority, &the_thread->Wait.Node.RBTree ); _RBTree_Insert( - &the_thread_queue->Queues.Priority, + &queue->Heads.Priority, &the_thread->Wait.Node.RBTree, _Thread_queue_Compare_priority, false @@ -92,19 +92,19 @@ static void _Thread_queue_Priority_priority_change( } static void _Thread_queue_Priority_initialize( - Thread_queue_Control *the_thread_queue + Thread_queue_Queue *queue ) { - _RBTree_Initialize_empty( &the_thread_queue->Queues.Priority ); + _RBTree_Initialize_empty( &queue->Heads.Priority ); } static void _Thread_queue_Priority_enqueue( - Thread_queue_Control *the_thread_queue, - Thread_Control *the_thread + Thread_queue_Queue *queue, + Thread_Control *the_thread ) { _RBTree_Insert( - &the_thread_queue->Queues.Priority, + &queue->Heads.Priority, &the_thread->Wait.Node.RBTree, _Thread_queue_Compare_priority, false @@ -112,23 +112,23 @@ static void _Thread_queue_Priority_enqueue( } static void _Thread_queue_Priority_extract( - Thread_queue_Control *the_thread_queue, - Thread_Control *the_thread + Thread_queue_Queue *queue, + Thread_Control *the_thread ) { _RBTree_Extract( - &the_thread_queue->Queues.Priority, + &queue->Heads.Priority, &the_thread->Wait.Node.RBTree ); } static Thread_Control *_Thread_queue_Priority_first( - Thread_queue_Control *the_thread_queue + Thread_queue_Queue *queue ) { RBTree_Node *first; - first = _RBTree_First( &the_thread_queue->Queues.Priority, RBT_LEFT ); + first = _RBTree_First( &queue->Heads.Priority, RBT_LEFT ); return first != NULL ? THREAD_RBTREE_NODE_TO_THREAD( first ) : NULL; } |