diff options
author | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2013-06-12 11:39:49 +0200 |
---|---|---|
committer | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2013-06-14 16:26:08 +0200 |
commit | 8f420927ac5ddaf47311cf272fe2ae0032bffd25 (patch) | |
tree | e26108c555162866b7bd1ebc0a44862e764ca340 /cpukit/score/inline/rtems | |
parent | scheduler: Add and use _Scheduler_default_Tick() (diff) | |
download | rtems-8f420927ac5ddaf47311cf272fe2ae0032bffd25.tar.bz2 |
scheduler: Simplify simple scheduler
Add and use _Scheduler_simple_Insert_priority_fifo_order(),
_Scheduler_simple_Insert_priority_lifo_order(),
_Scheduler_simple_Insert_priority_fifo() and
_Scheduler_simple_Insert_priority_lifo().
Diffstat (limited to 'cpukit/score/inline/rtems')
-rw-r--r-- | cpukit/score/inline/rtems/score/schedulersimple.inl | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/cpukit/score/inline/rtems/score/schedulersimple.inl b/cpukit/score/inline/rtems/score/schedulersimple.inl index e67fc3cd84..8b2480ea0a 100644 --- a/cpukit/score/inline/rtems/score/schedulersimple.inl +++ b/cpukit/score/inline/rtems/score/schedulersimple.inl @@ -48,6 +48,52 @@ RTEMS_INLINE_ROUTINE void _Scheduler_simple_Ready_queue_requeue( _Scheduler_simple_Ready_queue_enqueue( the_thread ); } +RTEMS_INLINE_ROUTINE bool _Scheduler_simple_Insert_priority_lifo_order( + const Chain_Node *to_insert, + const Chain_Node *next +) +{ + const Thread_Control *thread_to_insert = (const Thread_Control *) to_insert; + const Thread_Control *thread_next = (const Thread_Control *) next; + + return thread_to_insert->current_priority <= thread_next->current_priority; +} + +RTEMS_INLINE_ROUTINE bool _Scheduler_simple_Insert_priority_fifo_order( + const Chain_Node *to_insert, + const Chain_Node *next +) +{ + const Thread_Control *thread_to_insert = (const Thread_Control *) to_insert; + const Thread_Control *thread_next = (const Thread_Control *) next; + + return thread_to_insert->current_priority < thread_next->current_priority; +} + +RTEMS_INLINE_ROUTINE void _Scheduler_simple_Insert_priority_lifo( + Chain_Control *chain, + Thread_Control *to_insert +) +{ + _Chain_Insert_ordered_unprotected( + chain, + &to_insert->Object.Node, + _Scheduler_simple_Insert_priority_lifo_order + ); +} + +RTEMS_INLINE_ROUTINE void _Scheduler_simple_Insert_priority_fifo( + Chain_Control *chain, + Thread_Control *to_insert +) +{ + _Chain_Insert_ordered_unprotected( + chain, + &to_insert->Object.Node, + _Scheduler_simple_Insert_priority_fifo_order + ); +} + /** @} */ #endif |