source: rtems/cpukit/score/src/threadget.c @ 2bc236ba

4.104.114.84.95
Last change on this file since 2bc236ba was 05279b84, checked in by Ralf Corsepius <ralf.corsepius@…>, on 04/17/04 at 13:32:13

Remove stray white spaces.

  • 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#include <rtems/system.h>
16#include <rtems/score/apiext.h>
17#include <rtems/score/context.h>
18#include <rtems/score/interr.h>
19#include <rtems/score/isr.h>
20#include <rtems/score/object.h>
21#include <rtems/score/priority.h>
22#include <rtems/score/states.h>
23#include <rtems/score/sysstate.h>
24#include <rtems/score/thread.h>
25#include <rtems/score/threadq.h>
26#include <rtems/score/userext.h>
27#include <rtems/score/wkspace.h>
28
29/*PAGE
30 *
31 *  _Thread_Get
32 *
33 *  NOTE:  If we are not using static inlines, this must be a real
34 *         subroutine call.
35 *
36 *  NOTE:  XXX... This routine may be able to be optimized.
37 */
38
39#ifndef RTEMS_INLINES
40
41Thread_Control *_Thread_Get (
42  Objects_Id           id,
43  Objects_Locations   *location
44)
45{
46  uint32_t             the_api;
47  uint32_t             the_class;
48  Objects_Information *information;
49  Thread_Control      *tp = (Thread_Control *) 0;
50
51  if ( _Objects_Are_ids_equal( id, OBJECTS_ID_OF_SELF ) ) {
52    _Thread_Disable_dispatch();
53    *location = OBJECTS_LOCAL;
54    tp = _Thread_Executing;
55    goto done;
56  }
57
58  the_api = _Objects_Get_API( id );
59  if ( the_api && the_api > OBJECTS_APIS_LAST ) {
60    *location = OBJECTS_ERROR;
61    goto done;
62  }
63
64  the_class = _Objects_Get_class( id );
65  if ( the_class != 1 ) {       /* threads are always first class :) */
66    *location = OBJECTS_ERROR;
67    goto done;
68  }
69
70  information = _Objects_Information_table[ the_api ][ the_class ];
71
72  if ( !information ) {
73    *location = OBJECTS_ERROR;
74    goto done;
75  }
76
77  tp = (Thread_Control *) _Objects_Get( information, id, location );
78
79done:
80  return tp;
81}
82
83#endif
Note: See TracBrowser for help on using the repository browser.