source: rtems/cpukit/score/src/threadresettimeslice.c @ 4e97166

4.104.114.84.95
Last change on this file since 4e97166 was a8eed23, checked in by Ralf Corsepius <ralf.corsepius@…>, on 01/27/05 at 05:57:05

Include config.h.

  • Property mode set to 100644
File size: 1.8 KB
Line 
1/*
2 *  Thread Handler
3 *
4 *
5 *  COPYRIGHT (c) 1989-1999.
6 *  On-Line Applications Research Corporation (OAR).
7 *
8 *  The license and distribution terms for this file may be
9 *  found in found in the file LICENSE in this distribution or at
10 *  http://www.rtems.com/license/LICENSE.
11 *
12 *  $Id$
13 */
14
15#if HAVE_CONFIG_H
16#include "config.h"
17#endif
18
19#include <rtems/system.h>
20#include <rtems/score/apiext.h>
21#include <rtems/score/context.h>
22#include <rtems/score/interr.h>
23#include <rtems/score/isr.h>
24#include <rtems/score/object.h>
25#include <rtems/score/priority.h>
26#include <rtems/score/states.h>
27#include <rtems/score/sysstate.h>
28#include <rtems/score/thread.h>
29#include <rtems/score/threadq.h>
30#include <rtems/score/userext.h>
31#include <rtems/score/wkspace.h>
32
33/*PAGE
34 *
35 *  _Thread_Reset_timeslice
36 *
37 *  This routine will remove the running thread from the ready chain
38 *  and place it immediately at the rear of this chain and then the
39 *  timeslice counter is reset.  The heir THREAD will be updated if
40 *  the running is also the currently the heir.
41 *
42 *  Input parameters:   NONE
43 *
44 *  Output parameters:  NONE
45 *
46 *  INTERRUPT LATENCY:
47 *    ready chain
48 *    select heir
49 */
50
51void _Thread_Reset_timeslice( void )
52{
53  ISR_Level       level;
54  Thread_Control *executing;
55  Chain_Control  *ready;
56
57  executing = _Thread_Executing;
58  ready     = executing->ready;
59  _ISR_Disable( level );
60    if ( _Chain_Has_only_one_node( ready ) ) {
61      _ISR_Enable( level );
62      return;
63    }
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 *) ready->first;
71
72    _Context_Switch_necessary = TRUE;
73
74  _ISR_Enable( level );
75}
Note: See TracBrowser for help on using the repository browser.