1 | /** |
---|
2 | * @file |
---|
3 | * |
---|
4 | * @brief Scheduler EDF Extract |
---|
5 | * @ingroup ScoreScheduler |
---|
6 | */ |
---|
7 | |
---|
8 | /* |
---|
9 | * Copyright (C) 2011 Petr Benes. |
---|
10 | * Copyright (C) 2011 On-Line Applications Research Corporation (OAR). |
---|
11 | * |
---|
12 | * The license and distribution terms for this file may be |
---|
13 | * found in the file LICENSE in this distribution or at |
---|
14 | * http://www.rtems.org/license/LICENSE. |
---|
15 | */ |
---|
16 | |
---|
17 | #if HAVE_CONFIG_H |
---|
18 | #include "config.h" |
---|
19 | #endif |
---|
20 | |
---|
21 | #include <rtems/score/scheduleredfimpl.h> |
---|
22 | |
---|
23 | void _Scheduler_EDF_Update_priority( |
---|
24 | const Scheduler_Control *scheduler, |
---|
25 | Thread_Control *the_thread, |
---|
26 | Scheduler_Node *node |
---|
27 | ) |
---|
28 | { |
---|
29 | Scheduler_EDF_Context *context; |
---|
30 | Scheduler_EDF_Node *the_node; |
---|
31 | Priority_Control priority; |
---|
32 | Priority_Control insert_priority; |
---|
33 | |
---|
34 | if ( !_Thread_Is_ready( the_thread ) ) { |
---|
35 | /* Nothing to do */ |
---|
36 | return; |
---|
37 | } |
---|
38 | |
---|
39 | the_node = _Scheduler_EDF_Node_downcast( node ); |
---|
40 | insert_priority = _Scheduler_Node_get_priority( &the_node->Base ); |
---|
41 | priority = SCHEDULER_PRIORITY_PURIFY( insert_priority ); |
---|
42 | |
---|
43 | if ( priority == the_node->priority ) { |
---|
44 | /* Nothing to do */ |
---|
45 | return; |
---|
46 | } |
---|
47 | |
---|
48 | the_node->priority = priority; |
---|
49 | context = _Scheduler_EDF_Get_context( scheduler ); |
---|
50 | |
---|
51 | _Scheduler_EDF_Extract( context, the_node ); |
---|
52 | _Scheduler_EDF_Enqueue( context, the_node, insert_priority ); |
---|
53 | _Scheduler_EDF_Schedule_body( scheduler, the_thread, false ); |
---|
54 | } |
---|