RTEMS
scheduleredfreleasejob.c
Go to the documentation of this file.
1 
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 #ifdef HAVE_CONFIG_H
19 #include "config.h"
20 #endif
21 
23 
25  const Scheduler_Control *scheduler,
26  Priority_Control priority
27 )
28 {
30 }
31 
33  const Scheduler_Control *scheduler,
34  Priority_Control priority
35 )
36 {
38 }
39 
41  const Scheduler_Control *scheduler,
42  Thread_Control *the_thread,
43  Priority_Node *priority_node,
44  uint64_t deadline,
45  Thread_queue_Context *queue_context
46 )
47 {
48  (void) scheduler;
49 
50  _Thread_Wait_acquire_critical( the_thread, queue_context );
51 
52  /*
53  * There is no integer overflow problem here due to the
54  * SCHEDULER_PRIORITY_MAP(). The deadline is in clock ticks. With the
55  * minimum clock tick interval of 1us, the uptime is limited to about 146235
56  * years.
57  */
59  priority_node,
60  SCHEDULER_PRIORITY_MAP( deadline )
61  );
62 
63  if ( _Priority_Node_is_active( priority_node ) ) {
65  the_thread,
66  priority_node,
67  false,
68  queue_context
69  );
70  } else {
71  _Thread_Priority_add( the_thread, priority_node, queue_context );
72  }
73 
74  _Thread_Wait_release_critical( the_thread, queue_context );
75 }
76 
78  const Scheduler_Control *scheduler,
79  Thread_Control *the_thread,
80  Priority_Node *priority_node,
81  Thread_queue_Context *queue_context
82 )
83 {
84  (void) scheduler;
85 
86  _Thread_Wait_acquire_critical( the_thread, queue_context );
87 
88  if ( _Priority_Node_is_active( priority_node ) ) {
89  _Thread_Priority_remove( the_thread, priority_node, queue_context );
90  _Priority_Node_set_inactive( priority_node );
91  }
92 
93  _Thread_Wait_release_critical( the_thread, queue_context );
94 }
#define SCHEDULER_EDF_PRIO_MSB
uint64_t Priority_Control
The thread priority control.
Definition: priority.h:70
Thread queue context for the thread queue methods.
Definition: threadq.h:198
The priority node to build up a priority aggregation.
Definition: priority.h:98
static __inline__ void _Priority_Node_set_inactive(Priority_Node *node)
Sets the priority node inactive.
Definition: priorityimpl.h:184
void _Scheduler_EDF_Release_job(const Scheduler_Control *scheduler, Thread_Control *the_thread, Priority_Node *priority_node, uint64_t deadline, Thread_queue_Context *queue_context)
Releases a EDF job.
static __inline__ void _Thread_Wait_acquire_critical(Thread_Control *the_thread, Thread_queue_Context *queue_context)
Acquires the thread wait lock inside a critical section (interrupts disabled).
Definition: threadimpl.h:1812
void _Thread_Priority_changed(Thread_Control *the_thread, Priority_Node *priority_node, bool prepend_it, Thread_queue_Context *queue_context)
Propagates a thread priority value change in the specified thread priority node to the corresponding ...
#define SCHEDULER_PRIORITY_MAP(priority)
Maps a priority value to support the append indicator.
EDF Scheduler Implementation.
#define SCHEDULER_PRIORITY_UNMAP(priority)
Returns the plain priority value.
static __inline__ void _Priority_Node_set_priority(Priority_Node *node, Priority_Control priority)
Sets the priority of the priority node to the given priority.
Definition: priorityimpl.h:171
void _Scheduler_EDF_Cancel_job(const Scheduler_Control *scheduler, Thread_Control *the_thread, Priority_Node *priority_node, Thread_queue_Context *queue_context)
Cancels a job and removes the thread from the queue context.
Priority_Control _Scheduler_EDF_Unmap_priority(const Scheduler_Control *scheduler, Priority_Control priority)
Gets the unmapped priority map of the priority control.
Priority_Control _Scheduler_EDF_Map_priority(const Scheduler_Control *scheduler, Priority_Control priority)
Gets the mapped priority map of the priority control.
Scheduler control.
Definition: scheduler.h:264
void _Thread_Priority_remove(Thread_Control *the_thread, Priority_Node *priority_node, Thread_queue_Context *queue_context)
Removes the specified thread priority node from the corresponding thread priority aggregation...
static __inline__ bool _Priority_Node_is_active(const Priority_Node *node)
Checks if the priority node is active.
Definition: priorityimpl.h:199
void _Thread_Priority_add(Thread_Control *the_thread, Priority_Node *priority_node, Thread_queue_Context *queue_context)
Adds the specified thread priority node to the corresponding thread priority aggregation.
static __inline__ void _Thread_Wait_release_critical(Thread_Control *the_thread, Thread_queue_Context *queue_context)
Releases the thread wait lock inside a critical section (interrupts disabled).
Definition: threadimpl.h:1887