source: rtems/cpukit/score/src/schedulersimpleunblock.c @ 0daa8ab

5
Last change on this file since 0daa8ab was ca1e546e, checked in by Sebastian Huber <sebastian.huber@…>, on 02/02/17 at 15:24:05

score: Improve scheduler helping protocol

Only register ask for help requests in the scheduler unblock and yield
operations. The actual ask for help operation is carried out during
_Thread_Do_dispatch() on a processor related to the thread. This yields
a better separation of scheduler instances. A thread of one scheduler
instance should not be forced to carry out too much work for threads on
other scheduler instances.

Update #2556.

  • Property mode set to 100644
File size: 1.5 KB
Line 
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
24void _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}
Note: See TracBrowser for help on using the repository browser.