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

4.115
Last change on this file since c499856 was c499856, checked in by Chris Johns <chrisj@…>, on 03/20/14 at 21:10:47

Change all references of rtems.com to rtems.org.

  • Property mode set to 100644
File size: 973 bytes
Line 
1/**
2 * @file
3 *
4 * @brief Sets States for a Thread
5 *
6 * @ingroup ScoreThread
7 */
8
9/*
10 *  Thread Handler / Thread Set State
11 *
12 *  COPYRIGHT (c) 1989-2011.
13 *  On-Line Applications Research Corporation (OAR).
14 *
15 *  The license and distribution terms for this file may be
16 *  found in the file LICENSE in this distribution or at
17 *  http://www.rtems.org/license/LICENSE.
18 */
19
20#if HAVE_CONFIG_H
21#include "config.h"
22#endif
23
24#include <rtems/score/threadimpl.h>
25#include <rtems/score/isrlevel.h>
26#include <rtems/score/schedulerimpl.h>
27
28void _Thread_Set_state(
29  Thread_Control *the_thread,
30  States_Control  state
31)
32{
33  ISR_Level      level;
34  States_Control current_state;
35
36  _ISR_Disable( level );
37
38  current_state = the_thread->current_state;
39  if ( _States_Is_ready( current_state ) ) {
40    the_thread->current_state = state;
41
42    _Scheduler_Block( the_thread );
43  } else {
44    the_thread->current_state = _States_Set( state, current_state);
45  }
46
47  _ISR_Enable( level );
48}
Note: See TracBrowser for help on using the repository browser.