source: rtems/cpukit/score/inline/rtems/score/schedulersimple.inl @ 8f42092

4.11
Last change on this file since 8f42092 was 8f42092, checked in by Sebastian Huber <sebastian.huber@…>, on Jun 12, 2013 at 9:39:49 AM

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().

  • Property mode set to 100644
File size: 2.5 KB
Line 
1/**
2 * @file
3 *
4 * @brief Inlined Routines Associated with the Manipulation of the
5 * Priority-Based Scheduling Structures
6 *
7 * This inline file contains all of the inlined routines associated with
8 * the manipulation of the priority-based scheduling structures.
9 */
10
11/*
12 *  Copyright (C) 2011 On-Line Applications Research Corporation (OAR).
13 *
14 *  The license and distribution terms for this file may be
15 *  found in the file LICENSE in this distribution or at
16 *  http://www.rtems.com/license/LICENSE.
17 */
18
19#ifndef _RTEMS_SCORE_SCHEDULERSIMPLE_H
20# error "Never use <rtems/score/schedulersimple.inl> directly; include <rtems/score/schedulersimple.h> instead."
21#endif
22
23#ifndef _RTEMS_SCORE_SCHEDULERSIMPLE_INL
24#define _RTEMS_SCORE_SCHEDULERSIMPLE_INL
25
26#include <rtems/score/thread.h>
27
28/**
29 * @addtogroup ScoreScheduler
30 */
31/**@{**/
32
33/**
34 * This routine puts @a the_thread on to the ready queue.
35 *
36 * @param[in] the_ready_queue is a pointer to the ready queue head
37 * @param[in] the_thread is the thread to be blocked
38 */
39RTEMS_INLINE_ROUTINE void _Scheduler_simple_Ready_queue_requeue(
40  Scheduler_Control *the_ready_queue,
41  Thread_Control    *the_thread
42)
43{
44  /* extract */
45  _Chain_Extract_unprotected( &the_thread->Object.Node );
46
47  /* enqueue */
48  _Scheduler_simple_Ready_queue_enqueue( the_thread );
49}
50
51RTEMS_INLINE_ROUTINE bool _Scheduler_simple_Insert_priority_lifo_order(
52  const Chain_Node *to_insert,
53  const Chain_Node *next
54)
55{
56  const Thread_Control *thread_to_insert = (const Thread_Control *) to_insert;
57  const Thread_Control *thread_next = (const Thread_Control *) next;
58
59  return thread_to_insert->current_priority <= thread_next->current_priority;
60}
61
62RTEMS_INLINE_ROUTINE bool _Scheduler_simple_Insert_priority_fifo_order(
63  const Chain_Node *to_insert,
64  const Chain_Node *next
65)
66{
67  const Thread_Control *thread_to_insert = (const Thread_Control *) to_insert;
68  const Thread_Control *thread_next = (const Thread_Control *) next;
69
70  return thread_to_insert->current_priority < thread_next->current_priority;
71}
72
73RTEMS_INLINE_ROUTINE void _Scheduler_simple_Insert_priority_lifo(
74  Chain_Control *chain,
75  Thread_Control *to_insert
76)
77{
78  _Chain_Insert_ordered_unprotected(
79    chain,
80    &to_insert->Object.Node,
81    _Scheduler_simple_Insert_priority_lifo_order
82  );
83}
84
85RTEMS_INLINE_ROUTINE void _Scheduler_simple_Insert_priority_fifo(
86  Chain_Control *chain,
87  Thread_Control *to_insert
88)
89{
90  _Chain_Insert_ordered_unprotected(
91    chain,
92    &to_insert->Object.Node,
93    _Scheduler_simple_Insert_priority_fifo_order
94  );
95}
96
97/** @} */
98
99#endif
100/* end of include file */
Note: See TracBrowser for help on using the repository browser.