source: rtems/cpukit/score/include/rtems/score/scheduleredfimpl.h @ 7e119990

4.11
Last change on this file since 7e119990 was 08d9760, checked in by Sebastian Huber <sebastian.huber@…>, on Jul 8, 2014 at 12:25:55 PM

score: Rename *_Node_get() to *_Thread_get_node()

This emphasizes that the scheduler node of a thread is returned and this
is not a function working with scheduler nodes like the other *_Node_*()
functions.

  • Property mode set to 100644
File size: 2.3 KB
Line 
1/**
2 * @file
3 *
4 * @ingroup ScoreSchedulerEDF
5 *
6 * @brief EDF Scheduler Implementation
7 */
8
9/*
10 *  Copryight (c) 2011 Petr Benes.
11 *  Copyright (C) 2011 On-Line Applications Research Corporation (OAR).
12 *
13 *  The license and distribution terms for this file may be
14 *  found in the file LICENSE in this distribution or at
15 *  http://www.rtems.org/license/LICENSE.
16 */
17
18#ifndef _RTEMS_SCORE_SCHEDULEREDFIMPL_H
19#define _RTEMS_SCORE_SCHEDULEREDFIMPL_H
20
21#include <rtems/score/scheduleredf.h>
22#include <rtems/score/schedulerimpl.h>
23
24#ifdef __cplusplus
25extern "C" {
26#endif
27
28/**
29 * @addtogroup ScoreSchedulerEDF EDF
30 *
31 * @{
32 */
33
34RTEMS_INLINE_ROUTINE Scheduler_EDF_Context *
35  _Scheduler_EDF_Get_context( const Scheduler_Control *scheduler )
36{
37  return (Scheduler_EDF_Context *) _Scheduler_Get_context( scheduler );
38}
39
40RTEMS_INLINE_ROUTINE Scheduler_EDF_Node *_Scheduler_EDF_Thread_get_node(
41  Thread_Control *the_thread
42)
43{
44  return (Scheduler_EDF_Node *) _Scheduler_Thread_get_node( the_thread );
45}
46
47RTEMS_INLINE_ROUTINE void _Scheduler_EDF_Enqueue(
48  const Scheduler_Control *scheduler,
49  Thread_Control          *the_thread
50)
51{
52  Scheduler_EDF_Context *context =
53    _Scheduler_EDF_Get_context( scheduler );
54  Scheduler_EDF_Node *node = _Scheduler_EDF_Thread_get_node( the_thread );
55
56  _RBTree_Insert( &context->Ready, &node->Node );
57  node->queue_state = SCHEDULER_EDF_QUEUE_STATE_YES;
58}
59
60RTEMS_INLINE_ROUTINE void _Scheduler_EDF_Extract(
61  const Scheduler_Control *scheduler,
62  Thread_Control          *the_thread
63)
64{
65  Scheduler_EDF_Context *context =
66    _Scheduler_EDF_Get_context( scheduler );
67  Scheduler_EDF_Node *node = _Scheduler_EDF_Thread_get_node( the_thread );
68
69  _RBTree_Extract( &context->Ready, &node->Node );
70}
71
72RTEMS_INLINE_ROUTINE void _Scheduler_EDF_Schedule_body(
73  const Scheduler_Control *scheduler,
74  Thread_Control          *the_thread,
75  bool                     force_dispatch
76)
77{
78  Scheduler_EDF_Context *context =
79    _Scheduler_EDF_Get_context( scheduler );
80  RBTree_Node *first = _RBTree_First( &context->Ready, RBT_LEFT );
81  Scheduler_EDF_Node *node =
82    _RBTree_Container_of(first, Scheduler_EDF_Node, Node);
83  Thread_Control *heir = node->thread;
84
85  ( void ) the_thread;
86
87  _Scheduler_Update_heir( heir, force_dispatch );
88}
89
90/**@}*/
91
92#ifdef __cplusplus
93}
94#endif
95
96#endif
97/* end of include file */
Note: See TracBrowser for help on using the repository browser.