source: rtems/cpukit/score/src/schedulerpriorityyield.c @ dcf3687

4.115
Last change on this file since dcf3687 was dcf3687, checked in by Joel Sherrill <joel.sherrill@…>, on 01/28/11 at 20:24:54

2011-01-28 Joel Sherrill <joel.sherrilL@…>

  • include/rtems/bspIo.h, include/rtems/concat.h, include/rtems/irq.h, score/cpu/i386/rtems/score/idtr.h, score/cpu/powerpc/rtems/powerpc/registers.h, score/src/objectidtoname.c, score/src/schedulerpriorityblock.c, score/src/schedulerpriorityschedule.c, score/src/schedulerpriorityunblock.c, score/src/schedulerpriorityyield.c, score/src/thread.c, score/src/threadchangepriority.c, score/src/threadclearstate.c, score/src/threadclose.c, score/src/threadcreateidle.c, score/src/threaddelayended.c, score/src/threaddispatch.c, score/src/threadget.c, score/src/threadhandler.c, score/src/threadinitialize.c, score/src/threadloadenv.c, score/src/threadready.c, score/src/threadreset.c, score/src/threadrestart.c, score/src/threadresume.c, score/src/threadsetpriority.c, score/src/threadsetstate.c, score/src/threadsettransient.c, score/src/threadstackallocate.c, score/src/threadstackfree.c, score/src/threadstart.c, score/src/threadstartmultitasking.c, score/src/threadsuspend.c, score/src/threadtickletimeslice.c, score/src/threadyieldprocessor.c: Fix typo where license said found in found in.
  • Property mode set to 100644
File size: 2.1 KB
Line 
1/*
2 *  Scheduler Handler
3 *
4 *  Copyright (C) 2010 Gedare Bloom.
5 *
6 *  The license and distribution terms for this file may be
7 *  found in the file LICENSE in this distribution or at
8 *  http://www.rtems.com/license/LICENSE.
9 *
10 *  $Id$
11 */
12
13#if HAVE_CONFIG_H
14#include "config.h"
15#endif
16
17#include <rtems/system.h>
18#include <rtems/score/apiext.h>
19#include <rtems/score/context.h>
20#include <rtems/score/interr.h>
21#include <rtems/score/isr.h>
22#include <rtems/score/object.h>
23#include <rtems/score/priority.h>
24#include <rtems/score/scheduler.h>
25#include <rtems/score/states.h>
26#include <rtems/score/sysstate.h>
27#include <rtems/score/thread.h>
28#include <rtems/score/threadq.h>
29#include <rtems/score/userext.h>
30#include <rtems/score/wkspace.h>
31
32/*
33 *  _Scheduler_priority_Yield
34 *
35 *  This kernel routine will remove the running THREAD from the ready queue
36 *  and place it immediately at the rear of this chain.  Reset timeslice
37 *  and yield the processor functions both use this routine, therefore if
38 *  reset is true and this is the only thread on the queue then the
39 *  timeslice counter is reset.  The heir THREAD will be updated if the
40 *  running is also the currently the heir.
41 *
42 *  Input parameters:
43 *    the_scheduler - pointer to scheduler control
44 *
45 *  Output parameters:  NONE
46 *
47 *  INTERRUPT LATENCY:
48 *    ready chain
49 *    select heir
50 */
51
52void _Scheduler_priority_Yield(
53    Scheduler_Control   *the_scheduler __attribute__((unused))
54)
55{
56  ISR_Level       level;
57  Thread_Control *executing;
58  Chain_Control  *ready;
59
60  executing = _Thread_Executing;
61  ready = executing->scheduler.priority->ready_chain;
62  _ISR_Disable( level );
63    if ( !_Chain_Has_only_one_node( ready ) ) {
64      _Chain_Extract_unprotected( &executing->Object.Node );
65      _Chain_Append_unprotected( ready, &executing->Object.Node );
66
67      _ISR_Flash( level );
68
69      if ( _Thread_Is_heir( executing ) )
70        _Thread_Heir = (Thread_Control *) _Chain_First( ready );
71      _Thread_Dispatch_necessary = true;
72    }
73    else if ( !_Thread_Is_heir( executing ) )
74      _Thread_Dispatch_necessary = true;
75
76  _ISR_Enable( level );
77}
Note: See TracBrowser for help on using the repository browser.