From 0e1d11f3f0f02768ced350fcb53056c55f0c545b Mon Sep 17 00:00:00 2001 From: Sebastian Huber Date: Fri, 27 May 2016 13:26:53 +0200 Subject: score: Add _Thread_queue_Context_set_MP_callout() Add _Thread_queue_Context_set_MP_callout() to simplify _Thread_queue_Context_initialize(). This makes it possible to more easily add additional fields to Thread_queue_Context. --- cpukit/score/include/rtems/score/mrspimpl.h | 2 +- cpukit/score/include/rtems/score/threadq.h | 15 ++++++++ cpukit/score/include/rtems/score/threadqimpl.h | 47 ++++++++++++-------------- 3 files changed, 38 insertions(+), 26 deletions(-) (limited to 'cpukit/score/include/rtems') diff --git a/cpukit/score/include/rtems/score/mrspimpl.h b/cpukit/score/include/rtems/score/mrspimpl.h index ffdc802f6f..5a1fcda54d 100644 --- a/cpukit/score/include/rtems/score/mrspimpl.h +++ b/cpukit/score/include/rtems/score/mrspimpl.h @@ -189,7 +189,7 @@ RTEMS_INLINE_ROUTINE void _MRSP_Timeout( Watchdog_Control *watchdog ) Thread_Control *thread = rival->thread; Thread_queue_Context queue_context; - _Thread_queue_Context_initialize( &queue_context, NULL ); + _Thread_queue_Context_initialize( &queue_context ); _ISR_lock_ISR_disable( &queue_context.Lock_context ); _MRSP_Acquire_critical( mrsp, &queue_context ); diff --git a/cpukit/score/include/rtems/score/threadq.h b/cpukit/score/include/rtems/score/threadq.h index 467462d2b8..5f2ffe49a9 100644 --- a/cpukit/score/include/rtems/score/threadq.h +++ b/cpukit/score/include/rtems/score/threadq.h @@ -63,7 +63,22 @@ typedef void ( *Thread_queue_MP_callout )( * @see _Thread_queue_Context_initialize(). */ typedef struct { + /** + * @brief The lock context for the thread queue acquire and release + * operations. + */ ISR_lock_Context Lock_context; + + /** + * @brief Callout to unblock the thread in case it is actually a thread + * proxy. + * + * This field is only used on multiprocessing configurations. Used by + * thread queue extract and unblock methods for objects with multiprocessing + * (MP) support. + * + * @see _Thread_queue_Context_set_MP_callout(). + */ #if defined(RTEMS_MULTIPROCESSING) Thread_queue_MP_callout mp_callout; #endif diff --git a/cpukit/score/include/rtems/score/threadqimpl.h b/cpukit/score/include/rtems/score/threadqimpl.h index a8f404f299..4f5b48b6eb 100644 --- a/cpukit/score/include/rtems/score/threadqimpl.h +++ b/cpukit/score/include/rtems/score/threadqimpl.h @@ -53,47 +53,44 @@ typedef struct { Thread_queue_Queue Queue; } Thread_queue_Syslock_queue; -RTEMS_INLINE_ROUTINE void _Thread_queue_Do_context_initialize( - Thread_queue_Context *queue_context -#if defined(RTEMS_MULTIPROCESSING) - , - Thread_queue_MP_callout mp_callout -#endif +/** + * @brief Initializes a thread queue context. + * + * @param queue_context The thread queue context to initialize. + */ +RTEMS_INLINE_ROUTINE void _Thread_queue_Context_initialize( + Thread_queue_Context *queue_context ) { -#if defined(RTEMS_MULTIPROCESSING) - queue_context->mp_callout = mp_callout; +#if defined(RTEMS_MULTIPROCESSING) && defined(RTEMS_DEBUG) + queue_context->mp_callout = NULL; #else (void) queue_context; #endif } /** - * @brief Initializes a thread queue context. + * @brief Sets the MP callout in the thread queue context. * - * @param queue_context The thread queue context to initialize. + * @param queue_context The thread queue context. * @param mp_callout Callout to unblock the thread in case it is actually a * thread proxy. This parameter is only used on multiprocessing * configurations. Used by thread queue extract and unblock methods for * objects with multiprocessing (MP) support. */ #if defined(RTEMS_MULTIPROCESSING) - #define _Thread_queue_Context_initialize( \ - queue_context, \ - mp_callout \ - ) \ - _Thread_queue_Do_context_initialize( \ - queue_context, \ - mp_callout \ - ) +RTEMS_INLINE_ROUTINE void _Thread_queue_Context_set_MP_callout( + Thread_queue_Context *queue_context, + Thread_queue_MP_callout mp_callout +) +{ + queue_context->mp_callout = mp_callout; +} #else - #define _Thread_queue_Context_initialize( \ - queue_context, \ - mp_callout \ - ) \ - _Thread_queue_Do_context_initialize( \ - queue_context \ - ) +#define _Thread_queue_Context_set_MP_callout( queue_context, mp_callout ) \ + do { \ + (void) queue_context; \ + } while ( 0 ) #endif RTEMS_INLINE_ROUTINE void _Thread_queue_Heads_initialize( -- cgit v1.2.3