From 1e1a91ed11458ddbb27b94d0001d8f0fc2ef7a97 Mon Sep 17 00:00:00 2001 From: Sebastian Huber Date: Wed, 23 Mar 2016 10:01:31 +0100 Subject: score: Remove Thread_queue_Queue::operations field Remove the Thread_queue_Queue::operations field to reduce the size of this structure. Add a thread queue operations parameter to the _Thread_queue_First(), _Thread_queue_First_locked(), _Thread_queue_Enqueue(), _Thread_queue_Dequeue() and _Thread_queue_Flush() functions. This is a preparation patch to reduce the size of several synchronization objects. --- cpukit/score/src/coresem.c | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) (limited to 'cpukit/score/src/coresem.c') diff --git a/cpukit/score/src/coresem.c b/cpukit/score/src/coresem.c index 2475c349a7..db2d47f872 100644 --- a/cpukit/score/src/coresem.c +++ b/cpukit/score/src/coresem.c @@ -21,18 +21,21 @@ #include void _CORE_semaphore_Initialize( - CORE_semaphore_Control *the_semaphore, - const CORE_semaphore_Attributes *the_semaphore_attributes, - uint32_t initial_value + CORE_semaphore_Control *the_semaphore, + CORE_semaphore_Disciplines discipline, + uint32_t maximum_count, + uint32_t initial_value ) { - the_semaphore->Attributes = *the_semaphore_attributes; - the_semaphore->count = initial_value; + the_semaphore->Attributes.maximum_count = maximum_count; + the_semaphore->count = initial_value; - _Thread_queue_Initialize( - &the_semaphore->Wait_queue, - _CORE_semaphore_Is_priority( the_semaphore_attributes ) ? - THREAD_QUEUE_DISCIPLINE_PRIORITY : THREAD_QUEUE_DISCIPLINE_FIFO - ); + _Thread_queue_Initialize( &the_semaphore->Wait_queue ); + + if ( discipline == CORE_SEMAPHORE_DISCIPLINES_PRIORITY ) { + the_semaphore->operations = &_Thread_queue_Operations_priority; + } else { + the_semaphore->operations = &_Thread_queue_Operations_FIFO; + } } -- cgit v1.2.3