source: rtems/cpukit/score/src/threadsetstate.c @ b72e847b

4.8
Last change on this file since b72e847b was 96d0b64, checked in by Joel Sherrill <joel.sherrill@…>, on 03/05/07 at 21:01:40

2007-03-05 Joel Sherrill <joel@…>

PR 1222/cpukit

  • score/Makefile.am, score/include/rtems/score/coremutex.h, score/include/rtems/score/threadq.h, score/inline/rtems/score/coremutex.inl, score/src/coremsgsubmit.c, score/src/coremutexsurrender.c, score/src/threadchangepriority.c, score/src/threadclearstate.c, score/src/threadhandler.c, score/src/threadinitialize.c, score/src/threadqdequeuefifo.c, score/src/threadqdequeuepriority.c, score/src/threadqenqueue.c, score/src/threadqenqueuefifo.c, score/src/threadqenqueuepriority.c, score/src/threadqextractfifo.c, score/src/threadqextractpriority.c, score/src/threadsetstate.c: Enhance so that when the prioirity of a thread that is blocked on a priority based thread queue is changed, that its placement in the queue is reevaluated based upon the new priority. This enhancement includes modifications to the SuperCore? as well as new test cases.
  • score/src/threadqrequeue.c: New file.
  • Property mode set to 100644
File size: 1.9 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_Set_state
36 *
37 * This kernel routine sets the requested state in the THREAD.  The
38 * THREAD chain is adjusted if necessary.
39 *
40 * Input parameters:
41 *   the_thread   - pointer to thread control block
42 *   state - state to be set
43 *
44 * Output parameters:  NONE
45 *
46 *  INTERRUPT LATENCY:
47 *    ready chain
48 *    select map
49 */
50
51void _Thread_Set_state(
52  Thread_Control *the_thread,
53  States_Control  state
54)
55{
56  ISR_Level      level;
57  Chain_Control *ready;
58
59  ready = the_thread->ready;
60  _ISR_Disable( level );
61  if ( !_States_Is_ready( the_thread->current_state ) ) {
62    the_thread->current_state =
63       _States_Set( state, the_thread->current_state );
64    _ISR_Enable( level );
65    return;
66  }
67
68  the_thread->current_state = state;
69
70  if ( _Chain_Has_only_one_node( ready ) ) {
71
72    _Chain_Initialize_empty( ready );
73    _Priority_Remove_from_bit_map( &the_thread->Priority_map );
74
75  } else
76    _Chain_Extract_unprotected( &the_thread->Object.Node );
77
78  _ISR_Flash( level );
79
80  if ( _Thread_Is_heir( the_thread ) )
81     _Thread_Calculate_heir();
82
83  if ( _Thread_Is_executing( the_thread ) )
84    _Context_Switch_necessary = TRUE;
85
86  _ISR_Enable( level );
87}
Note: See TracBrowser for help on using the repository browser.