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/src/threadchangepriority.c | |
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/src/threadchangepriority.c')
-rw-r--r-- | cpukit/score/src/threadchangepriority.c | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/cpukit/score/src/threadchangepriority.c b/cpukit/score/src/threadchangepriority.c index 6ee65f53cc..dea671de3f 100644 --- a/cpukit/score/src/threadchangepriority.c +++ b/cpukit/score/src/threadchangepriority.c @@ -38,16 +38,20 @@ void _Thread_Change_priority( * we are not REALLY changing priority. */ if ( the_thread->current_priority != new_priority ) { - uint32_t my_generation = the_thread->priority_generation + 1; + uint32_t my_generation = the_thread->Priority.generation + 1; the_thread->current_priority = new_priority; - the_thread->priority_generation = my_generation; + the_thread->Priority.generation = my_generation; - _Thread_queue_Requeue( the_thread->Wait.queue, the_thread ); + (*the_thread->Priority.change_handler)( + the_thread, + new_priority, + the_thread->Priority.change_handler_context + ); _ISR_Flash( level ); - if ( the_thread->priority_generation == my_generation ) { + if ( the_thread->Priority.generation == my_generation ) { if ( _States_Is_ready( the_thread->current_state ) ) { _Scheduler_Change_priority( the_thread, |