1 | /** |
---|
2 | * @file |
---|
3 | * |
---|
4 | * @brief Scheduler Simple Handler / Unblock |
---|
5 | * @ingroup ScoreScheduler |
---|
6 | */ |
---|
7 | |
---|
8 | /* |
---|
9 | * COPYRIGHT (c) 2011. |
---|
10 | * On-Line Applications Research Corporation (OAR). |
---|
11 | * |
---|
12 | * The license and distribution terms for this file may be |
---|
13 | * found in 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/schedulersimpleimpl.h> |
---|
22 | #include <rtems/score/thread.h> |
---|
23 | |
---|
24 | void _Scheduler_simple_Unblock( |
---|
25 | const Scheduler_Control *scheduler, |
---|
26 | Thread_Control *the_thread, |
---|
27 | Scheduler_Node *node |
---|
28 | ) |
---|
29 | { |
---|
30 | Scheduler_simple_Context *context; |
---|
31 | Priority_Control priority; |
---|
32 | |
---|
33 | (void) node; |
---|
34 | |
---|
35 | context = _Scheduler_simple_Get_context( scheduler ); |
---|
36 | _Scheduler_simple_Insert_priority_fifo( &context->Ready, the_thread ); |
---|
37 | priority = _Thread_Get_priority( the_thread ); |
---|
38 | |
---|
39 | /* |
---|
40 | * If the thread that was unblocked is more important than the heir, |
---|
41 | * then we have a new heir. This may or may not result in a |
---|
42 | * context switch. |
---|
43 | * |
---|
44 | * Normal case: |
---|
45 | * If the current thread is preemptible, then we need to do |
---|
46 | * a context switch. |
---|
47 | * Pseudo-ISR case: |
---|
48 | * Even if the thread isn't preemptible, if the new heir is |
---|
49 | * a pseudo-ISR system task, we need to do a context switch. |
---|
50 | */ |
---|
51 | if ( priority < _Thread_Get_priority( _Thread_Heir ) ) { |
---|
52 | _Scheduler_Update_heir( |
---|
53 | the_thread, |
---|
54 | priority == PRIORITY_PSEUDO_ISR |
---|
55 | ); |
---|
56 | } |
---|
57 | } |
---|