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.OARcorp.com/rtems/license.html. |
---|
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 USE_INLINES |
---|
40 | |
---|
41 | Thread_Control *_Thread_Get ( |
---|
42 | Objects_Id id, |
---|
43 | Objects_Locations *location |
---|
44 | ) |
---|
45 | { |
---|
46 | Objects_Classes the_class; |
---|
47 | Objects_Information *information; |
---|
48 | |
---|
49 | if ( _Objects_Are_ids_equal( id, OBJECTS_ID_OF_SELF ) ) { |
---|
50 | _Thread_Disable_dispatch(); |
---|
51 | *location = OBJECTS_LOCAL; |
---|
52 | return( _Thread_Executing ); |
---|
53 | } |
---|
54 | |
---|
55 | the_class = _Objects_Get_class( id ); |
---|
56 | |
---|
57 | if ( the_class > OBJECTS_CLASSES_LAST ) { |
---|
58 | *location = OBJECTS_ERROR; |
---|
59 | return (Thread_Control *) 0; |
---|
60 | } |
---|
61 | |
---|
62 | information = _Objects_Information_table[ the_class ]; |
---|
63 | |
---|
64 | if ( !information || !information->is_thread ) { |
---|
65 | *location = OBJECTS_ERROR; |
---|
66 | return (Thread_Control *) 0; |
---|
67 | } |
---|
68 | |
---|
69 | return (Thread_Control *) _Objects_Get( information, id, location ); |
---|
70 | } |
---|
71 | |
---|
72 | #endif |
---|