[5472ad41] | 1 | /* |
---|
| 2 | * Copyright (C) 2011 Petr Benes. |
---|
| 3 | * Copyright (C) 2011 On-Line Applications Research Corporation (OAR). |
---|
| 4 | * |
---|
| 5 | * The license and distribution terms for this file may be |
---|
| 6 | * found in the file LICENSE in this distribution or at |
---|
| 7 | * http://www.rtems.com/license/LICENSE. |
---|
| 8 | * |
---|
| 9 | * $Id$ |
---|
| 10 | */ |
---|
| 11 | |
---|
| 12 | #if HAVE_CONFIG_H |
---|
| 13 | #include "config.h" |
---|
| 14 | #endif |
---|
| 15 | |
---|
| 16 | #include <rtems/system.h> |
---|
| 17 | #include <rtems/config.h> |
---|
| 18 | #include <rtems/score/priority.h> |
---|
| 19 | #include <rtems/score/scheduler.h> |
---|
| 20 | #include <rtems/score/scheduleredf.h> |
---|
| 21 | #include <rtems/score/thread.h> |
---|
| 22 | |
---|
| 23 | void _Scheduler_EDF_Update( |
---|
| 24 | Thread_Control *the_thread |
---|
| 25 | ) |
---|
| 26 | { |
---|
| 27 | Scheduler_EDF_Per_thread *sched_info = |
---|
| 28 | (Scheduler_EDF_Per_thread*)the_thread->scheduler_info; |
---|
| 29 | RBTree_Node *the_node = &(sched_info->Node); |
---|
| 30 | |
---|
| 31 | if (sched_info->queue_state == SCHEDULER_EDF_QUEUE_STATE_NEVER_HAS_BEEN) { |
---|
| 32 | /* Shifts the priority to the region of background tasks. */ |
---|
| 33 | the_thread->Start.initial_priority |= (SCHEDULER_EDF_PRIO_MSB); |
---|
| 34 | the_thread->real_priority = the_thread->Start.initial_priority; |
---|
| 35 | the_thread->current_priority = the_thread->Start.initial_priority; |
---|
| 36 | sched_info->queue_state = SCHEDULER_EDF_QUEUE_STATE_NOT_PRESENTLY; |
---|
| 37 | } |
---|
| 38 | |
---|
| 39 | if ( sched_info->queue_state == SCHEDULER_EDF_QUEUE_STATE_YES ) { |
---|
| 40 | _RBTree_Extract(&_Scheduler_EDF_Ready_queue, the_node); |
---|
| 41 | _RBTree_Insert(&_Scheduler_EDF_Ready_queue, the_node); |
---|
| 42 | |
---|
| 43 | _Scheduler_EDF_Schedule(); |
---|
| 44 | if ( _Thread_Executing != _Thread_Heir ) { |
---|
| 45 | if ( _Thread_Executing->is_preemptible || |
---|
| 46 | the_thread->current_priority == 0 ) |
---|
| 47 | _Thread_Dispatch_necessary = true; |
---|
| 48 | } |
---|
| 49 | } |
---|
| 50 | } |
---|