From 568af83542eec9343c24d417ed6a219d22046233 Mon Sep 17 00:00:00 2001 From: Sebastian Huber Date: Tue, 21 Apr 2015 10:17:13 +0200 Subject: score: Add Thread_queue_Operations Replace the Thread_Priority_control with more general Thread_queue_Operations which will be used for generic priority change, timeout, signal and wait queue operations in the future. Update #2273. --- cpukit/score/include/rtems/score/threadimpl.h | 88 ++++++++++++++++----------- 1 file changed, 53 insertions(+), 35 deletions(-) (limited to 'cpukit/score/include/rtems/score/threadimpl.h') diff --git a/cpukit/score/include/rtems/score/threadimpl.h b/cpukit/score/include/rtems/score/threadimpl.h index c266a9cce3..953b88b925 100644 --- a/cpukit/score/include/rtems/score/threadimpl.h +++ b/cpukit/score/include/rtems/score/threadimpl.h @@ -30,6 +30,7 @@ #include #include #include +#include #include #include @@ -1078,41 +1079,6 @@ RTEMS_INLINE_ROUTINE void _Thread_Lock_restore_default( do { } while ( 0 ) #endif -void _Thread_Priority_change_do_nothing( - Thread_Control *the_thread, - Priority_Control new_priority, - void *context -); - -/** - * @brief Sets the thread priority change handler and its context. - * - * @param[in] the_thread The thread. - * @param[in] new_handler The new handler. - * @param[in] new_context The new handler context. - */ -RTEMS_INLINE_ROUTINE void _Thread_Priority_set_change_handler( - Thread_Control *the_thread, - Thread_Priority_change_handler new_handler, - void *new_context -) -{ - the_thread->Priority.change_handler = new_handler; - the_thread->Priority.change_handler_context = new_context; -} - -/** - * @brief Restores the thread priority change default handler and its context. - * - * @param[in] the_thread The thread. - */ -RTEMS_INLINE_ROUTINE void _Thread_Priority_restore_default_change_handler( - Thread_Control *the_thread -) -{ - the_thread->Priority.change_handler = _Thread_Priority_change_do_nothing; -} - /** * @brief The initial thread wait flags value set by _Thread_Initialize(). */ @@ -1257,6 +1223,58 @@ RTEMS_INLINE_ROUTINE bool _Thread_Wait_flags_try_change( return success; } +/** + * @brief Sets the thread queue. + * + * The caller must be the owner of the thread lock. + * + * @param[in] the_thread The thread. + * @param[in] new_queue The new queue. + * + * @see _Thread_Lock_set(). + */ +RTEMS_INLINE_ROUTINE void _Thread_Wait_set_queue( + Thread_Control *the_thread, + Thread_queue_Control *new_queue +) +{ + the_thread->Wait.queue = new_queue; +} + +/** + * @brief Sets the thread queue operations. + * + * The caller must be the owner of the thread lock. + * + * @param[in] the_thread The thread. + * @param[in] new_operations The new queue operations. + * + * @see _Thread_Lock_set() and _Thread_Wait_restore_default_operations(). + */ +RTEMS_INLINE_ROUTINE void _Thread_Wait_set_operations( + Thread_Control *the_thread, + const Thread_queue_Operations *new_operations +) +{ + the_thread->Wait.operations = new_operations; +} + +/** + * @brief Restores the default thread queue operations. + * + * The caller must be the owner of the thread lock. + * + * @param[in] the_thread The thread. + * + * @see _Thread_Wait_set_operations(). + */ +RTEMS_INLINE_ROUTINE void _Thread_Wait_restore_default_operations( + Thread_Control *the_thread +) +{ + the_thread->Wait.operations = &_Thread_queue_Operations_default; +} + /** * @brief Sets the thread wait timeout code. * -- cgit v1.2.3