source: rtems/cpukit/score/src/schedulerpriorityunblock.c @ 24934e36

4.115
Last change on this file since 24934e36 was 24934e36, checked in by Sebastian Huber <sebastian.huber@…>, on 04/03/14 at 13:03:35

score: Add scheduler control to scheduler ops

Scheduler operations must be free of a global scheduler context to
enable partitioned/clustered scheduling.

  • Property mode set to 100644
File size: 1.4 KB
Line 
1/**
2 *  @file
3 *
4 *  @brief Scheduler Priority Unblock
5 *  @ingroup ScoreScheduler
6 */
7
8/*
9 *  Scheduler Handler
10 *
11 *  Copyright (C) 2010 Gedare Bloom.
12 *  Copyright (C) 2011 On-Line Applications Research Corporation (OAR).
13 *
14 *  The license and distribution terms for this file may be
15 *  found in the file LICENSE in this distribution or at
16 *  http://www.rtems.org/license/LICENSE.
17 */
18
19#if HAVE_CONFIG_H
20#include "config.h"
21#endif
22
23#include <rtems/score/schedulerpriorityimpl.h>
24
25void _Scheduler_priority_Unblock (
26  Scheduler_Control *base,
27  Thread_Control    *the_thread
28)
29{
30  Scheduler_priority_Control *self =
31    _Scheduler_priority_Self_from_base( base );
32
33  _Scheduler_priority_Ready_queue_enqueue( the_thread, &self->Bit_map );
34
35  /* TODO: flash critical section? */
36
37  /*
38   *  If the thread that was unblocked is more important than the heir,
39   *  then we have a new heir.  This may or may not result in a
40   *  context switch.
41   *
42   *  Normal case:
43   *    If the current thread is preemptible, then we need to do
44   *    a context switch.
45   *  Pseudo-ISR case:
46   *    Even if the thread isn't preemptible, if the new heir is
47   *    a pseudo-ISR system task, we need to do a context switch.
48   */
49  if ( the_thread->current_priority < _Thread_Heir->current_priority ) {
50    _Thread_Heir = the_thread;
51    if ( _Thread_Executing->is_preemptible ||
52        the_thread->current_priority == 0 )
53      _Thread_Dispatch_necessary = true;
54  }
55}
Note: See TracBrowser for help on using the repository browser.