source: rtems/cpukit/score/src/threadget.c @ a29d2e7

4.104.114.84.95
Last change on this file since a29d2e7 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.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_Get
36 *
37 *  NOTE:  If we are not using static inlines, this must be a real
38 *         subroutine call.
39 *
40 *  NOTE:  XXX... This routine may be able to be optimized.
41 */
42
43#ifndef RTEMS_INLINES
44
45Thread_Control *_Thread_Get (
46  Objects_Id           id,
47  Objects_Locations   *location
48)
49{
50  uint32_t             the_api;
51  uint32_t             the_class;
52  Objects_Information *information;
53  Thread_Control      *tp = (Thread_Control *) 0;
54
55  if ( _Objects_Are_ids_equal( id, OBJECTS_ID_OF_SELF ) ) {
56    _Thread_Disable_dispatch();
57    *location = OBJECTS_LOCAL;
58    tp = _Thread_Executing;
59    goto done;
60  }
61
62  the_api = _Objects_Get_API( id );
63  if ( the_api && the_api > OBJECTS_APIS_LAST ) {
64    *location = OBJECTS_ERROR;
65    goto done;
66  }
67
68  the_class = _Objects_Get_class( id );
69  if ( the_class != 1 ) {       /* threads are always first class :) */
70    *location = OBJECTS_ERROR;
71    goto done;
72  }
73
74  information = _Objects_Information_table[ the_api ][ the_class ];
75
76  if ( !information ) {
77    *location = OBJECTS_ERROR;
78    goto done;
79  }
80
81  tp = (Thread_Control *) _Objects_Get( information, id, location );
82
83done:
84  return tp;
85}
86
87#endif
Note: See TracBrowser for help on using the repository browser.