source: rtems/cpukit/score/src/scheduleredfunblock.c @ 5472ad41

4.115
Last change on this file since 5472ad41 was 5472ad41, checked in by Joel Sherrill <joel.sherrill@…>, on 09/11/11 at 20:52:37

2011-09-11 Petr Benes <benesp16@…>

PR 1896/cpukit

  • sapi/include/confdefs.h, score/Makefile.am, score/preinstall.am: Add Earliest Deadline First (EDF) Scheduling Algorithm implementation.
  • score/include/rtems/score/scheduleredf.h, score/src/scheduleredf.c, score/src/scheduleredfallocate.c, score/src/scheduleredfblock.c, score/src/scheduleredfenqueue.c, score/src/scheduleredfenqueuefirst.c, score/src/scheduleredfextract.c, score/src/scheduleredffree.c, score/src/scheduleredfprioritycompare.c, score/src/scheduleredfreleasejob.c, score/src/scheduleredfschedule.c, score/src/scheduleredfunblock.c, score/src/scheduleredfupdate.c, score/src/scheduleredfyield.c: New files.
  • Property mode set to 100644
File size: 1.3 KB
Line 
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/score/scheduler.h>
18#include <rtems/score/scheduleredf.h>
19
20void _Scheduler_EDF_Unblock(
21  Thread_Control    *the_thread
22)
23{
24  _Scheduler_EDF_Enqueue(the_thread);
25  /* TODO: flash critical section? */
26
27  /*
28   *  If the thread that was unblocked is more important than the heir,
29   *  then we have a new heir.  This may or may not result in a
30   *  context switch.
31   *
32   *  Normal case:
33   *    If the current thread is preemptible, then we need to do
34   *    a context switch.
35   *  Pseudo-ISR case:
36   *    Even if the thread isn't preemptible, if the new heir is
37   *    a pseudo-ISR system task, we need to do a context switch.
38   */
39  if ( _Scheduler_Is_priority_lower_than(
40         _Thread_Heir->current_priority,
41         the_thread->current_priority )) {
42    _Thread_Heir = the_thread;
43    if ( _Thread_Executing->is_preemptible ||
44         the_thread->current_priority == 0 )
45      _Thread_Dispatch_necessary = true;
46  }
47}
Note: See TracBrowser for help on using the repository browser.