1 | /** |
---|
2 | * @file |
---|
3 | * |
---|
4 | * @brief Scheduler CBS Release Job |
---|
5 | * |
---|
6 | * @ingroup ScoreScheduler |
---|
7 | */ |
---|
8 | |
---|
9 | /* |
---|
10 | * Copyright (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 | #if HAVE_CONFIG_H |
---|
19 | #include "config.h" |
---|
20 | #endif |
---|
21 | |
---|
22 | #include <rtems/score/schedulercbsimpl.h> |
---|
23 | |
---|
24 | void _Scheduler_CBS_Release_job( |
---|
25 | const Scheduler_Control *scheduler, |
---|
26 | Thread_Control *the_thread, |
---|
27 | Priority_Node *priority_node, |
---|
28 | uint64_t deadline, |
---|
29 | Thread_queue_Context *queue_context |
---|
30 | ) |
---|
31 | { |
---|
32 | Scheduler_CBS_Node *node; |
---|
33 | Scheduler_CBS_Server *serv_info; |
---|
34 | |
---|
35 | node = _Scheduler_CBS_Thread_get_node( the_thread ); |
---|
36 | serv_info = node->cbs_server; |
---|
37 | |
---|
38 | /* Budget replenishment for the next job. */ |
---|
39 | if ( serv_info != NULL ) { |
---|
40 | the_thread->cpu_time_budget = serv_info->parameters.budget; |
---|
41 | } |
---|
42 | |
---|
43 | node->deadline_node = priority_node; |
---|
44 | |
---|
45 | _Scheduler_EDF_Release_job( |
---|
46 | scheduler, |
---|
47 | the_thread, |
---|
48 | priority_node, |
---|
49 | deadline, |
---|
50 | queue_context |
---|
51 | ); |
---|
52 | } |
---|
53 | |
---|
54 | void _Scheduler_CBS_Cancel_job( |
---|
55 | const Scheduler_Control *scheduler, |
---|
56 | Thread_Control *the_thread, |
---|
57 | Priority_Node *priority_node, |
---|
58 | Thread_queue_Context *queue_context |
---|
59 | ) |
---|
60 | { |
---|
61 | Scheduler_CBS_Node *node; |
---|
62 | |
---|
63 | node = _Scheduler_CBS_Thread_get_node( the_thread ); |
---|
64 | |
---|
65 | if ( node->deadline_node != NULL ) { |
---|
66 | _Assert( node->deadline_node == priority_node ); |
---|
67 | node->deadline_node = NULL; |
---|
68 | |
---|
69 | _Scheduler_EDF_Cancel_job( |
---|
70 | scheduler, |
---|
71 | the_thread, |
---|
72 | priority_node, |
---|
73 | queue_context |
---|
74 | ); |
---|
75 | } |
---|
76 | } |
---|