diff options
author | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2015-03-17 16:28:50 +0100 |
---|---|---|
committer | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2015-03-24 14:35:04 +0100 |
commit | 2e9c3d5e2944a8782eac8a12d23af7559873ad0a (patch) | |
tree | d19a9f00f4ca76811e3e4d25af5b48f50a2d47c1 /cpukit/score/include/rtems/score/threadimpl.h | |
parent | cpukit/libmisc/utf8proc/utf8proc.c: Avoid overflow (diff) | |
download | rtems-2e9c3d5e2944a8782eac8a12d23af7559873ad0a.tar.bz2 |
score: Add thread priority change handler
Since the thread current priority change and thread queue requeue is
performed in one critical section it is possible to simplify the thread
queue requeue procedure. Add a thread queue agnostic thread priority
change handler so that we are able to use alternative thread queue
implementations.
Update #2273.
Diffstat (limited to 'cpukit/score/include/rtems/score/threadimpl.h')
-rw-r--r-- | cpukit/score/include/rtems/score/threadimpl.h | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/cpukit/score/include/rtems/score/threadimpl.h b/cpukit/score/include/rtems/score/threadimpl.h index b968a055c9..5376ce1660 100644 --- a/cpukit/score/include/rtems/score/threadimpl.h +++ b/cpukit/score/include/rtems/score/threadimpl.h @@ -883,6 +883,41 @@ RTEMS_INLINE_ROUTINE bool _Thread_Owns_resources( return owns_resources; } +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(). */ |