From 631b3c8967a329cdd53e54365e4e4c0aa93a4251 Mon Sep 17 00:00:00 2001 From: Sebastian Huber Date: Mon, 23 May 2016 11:40:18 +0200 Subject: score: Move thread queue MP callout to context Drop the multiprocessing (MP) dependent callout parameter from the thread queue extract, dequeue, flush and unblock methods. Merge this parameter with the lock context into new structure Thread_queue_Context. This helps to gets rid of the conditionally compiled method call helpers. --- cpukit/score/src/coremutexsurrender.c | 27 ++++++++++++--------------- 1 file changed, 12 insertions(+), 15 deletions(-) (limited to 'cpukit/score/src/coremutexsurrender.c') diff --git a/cpukit/score/src/coremutexsurrender.c b/cpukit/score/src/coremutexsurrender.c index 746fee118e..040a580592 100644 --- a/cpukit/score/src/coremutexsurrender.c +++ b/cpukit/score/src/coremutexsurrender.c @@ -23,12 +23,9 @@ #include #include -CORE_mutex_Status _CORE_mutex_Do_surrender( - CORE_mutex_Control *the_mutex, -#if defined(RTEMS_MULTIPROCESSING) - Thread_queue_MP_callout mp_callout, -#endif - ISR_lock_Context *lock_context +CORE_mutex_Status _CORE_mutex_Surrender( + CORE_mutex_Control *the_mutex, + Thread_queue_Context *queue_context ) { Thread_Control *the_thread; @@ -46,17 +43,17 @@ CORE_mutex_Status _CORE_mutex_Do_surrender( if ( the_mutex->Attributes.only_owner_release ) { if ( !_Thread_Is_executing( holder ) ) { - _ISR_lock_ISR_enable( lock_context ); + _ISR_lock_ISR_enable( &queue_context->Lock_context ); return CORE_MUTEX_STATUS_NOT_OWNER_OF_RESOURCE; } } - _Thread_queue_Acquire_critical( &the_mutex->Wait_queue, lock_context ); + _CORE_mutex_Acquire_critical( the_mutex, queue_context ); /* XXX already unlocked -- not right status */ if ( !the_mutex->nest_count ) { - _Thread_queue_Release( &the_mutex->Wait_queue, lock_context ); + _CORE_mutex_Release( the_mutex, queue_context ); return CORE_MUTEX_STATUS_SUCCESSFUL; } @@ -71,12 +68,12 @@ CORE_mutex_Status _CORE_mutex_Do_surrender( #if defined(RTEMS_DEBUG) switch ( the_mutex->Attributes.lock_nesting_behavior ) { case CORE_MUTEX_NESTING_ACQUIRES: - _Thread_queue_Release( &the_mutex->Wait_queue, lock_context ); + _CORE_mutex_Release( the_mutex, queue_context ); return CORE_MUTEX_STATUS_SUCCESSFUL; #if defined(RTEMS_POSIX_API) case CORE_MUTEX_NESTING_IS_ERROR: /* should never occur */ - _Thread_queue_Release( &the_mutex->Wait_queue, lock_context ); + _CORE_mutex_Release( the_mutex, queue_context ); return CORE_MUTEX_STATUS_NESTING_NOT_ALLOWED; #endif case CORE_MUTEX_NESTING_BLOCKS: @@ -84,7 +81,7 @@ CORE_mutex_Status _CORE_mutex_Do_surrender( break; } #else - _Thread_queue_Release( &the_mutex->Wait_queue, lock_context ); + _CORE_mutex_Release( the_mutex, queue_context ); /* must be CORE_MUTEX_NESTING_ACQUIRES or we wouldn't be here */ return CORE_MUTEX_STATUS_SUCCESSFUL; #endif @@ -126,7 +123,7 @@ CORE_mutex_Status _CORE_mutex_Do_surrender( &the_mutex->Wait_queue.Queue, the_mutex->operations, the_thread, - mp_callout + queue_context ); #if defined(RTEMS_MULTIPROCESSING) @@ -155,10 +152,10 @@ CORE_mutex_Status _CORE_mutex_Do_surrender( unblock, &the_mutex->Wait_queue.Queue, the_thread, - lock_context + &queue_context->Lock_context ); } else { - _Thread_queue_Release( &the_mutex->Wait_queue, lock_context ); + _CORE_mutex_Release( the_mutex, queue_context ); } /* -- cgit v1.2.3