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

4.115
Last change on this file since d4d7899 was d4d7899, checked in by Christopher Kerl <zargyyoyo@…>, on 11/28/12 at 19:31:53

score misc: Clean up Doxygen #2 (GCI 2012)

This patch is a task from GCI 2012 which improves the Doxygen
comments in the RTEMS source.

http://www.google-melange.com/gci/task/view/google/gci2012/7986213

  • Property mode set to 100644
File size: 2.0 KB
Line 
1/**
2 * @file
3 *
4 * @brief Maps Thread IDs to TCB Pointer
5 *
6 * @ingroup ScoreThread
7 */
8
9/*
10 *  COPYRIGHT (c) 1989-2011.
11 *  On-Line Applications Research Corporation (OAR).
12 *
13 *  The license and distribution terms for this file may be
14 *  found in the file LICENSE in this distribution or at
15 *  http://www.rtems.com/license/LICENSE.
16 */
17
18#if HAVE_CONFIG_H
19#include "config.h"
20#endif
21
22#include <rtems/system.h>
23#include <rtems/score/apiext.h>
24#include <rtems/score/context.h>
25#include <rtems/score/interr.h>
26#include <rtems/score/isr.h>
27#include <rtems/score/object.h>
28#include <rtems/score/priority.h>
29#include <rtems/score/states.h>
30#include <rtems/score/sysstate.h>
31#include <rtems/score/thread.h>
32#include <rtems/score/threadq.h>
33
34Thread_Control *_Thread_Get (
35  Objects_Id         id,
36  Objects_Locations *location
37)
38{
39  uint32_t             the_api;
40  uint32_t             the_class;
41  Objects_Information **api_information;
42  Objects_Information *information;
43  Thread_Control      *tp = (Thread_Control *) 0;
44
45  if ( _Objects_Are_ids_equal( id, OBJECTS_ID_OF_SELF ) ) {
46    _Thread_Disable_dispatch();
47    *location = OBJECTS_LOCAL;
48    tp = _Thread_Executing;
49    goto done;
50  }
51
52  the_api = _Objects_Get_API( id );
53  if ( !_Objects_Is_api_valid( the_api ) ) {
54    *location = OBJECTS_ERROR;
55    goto done;
56  }
57
58  the_class = _Objects_Get_class( id );
59  if ( the_class != 1 ) {       /* threads are always first class :) */
60    *location = OBJECTS_ERROR;
61    goto done;
62  }
63
64  api_information = _Objects_Information_table[ the_api ];
65  /*
66   *  There is no way for this to happen if POSIX is enabled.  But there
67   *  is actually a test case in sp43 for this which trips it whether or
68   *  not POSIX is enabled.  So in the interest of safety, this is left
69   *  on in all configurations.
70   */
71  if ( !api_information ) {
72    *location = OBJECTS_ERROR;
73    goto done;
74  }
75
76  information = api_information[ the_class ];
77  if ( !information ) {
78    *location = OBJECTS_ERROR;
79    goto done;
80  }
81
82  tp = (Thread_Control *) _Objects_Get( information, id, location );
83
84done:
85  return tp;
86}
87
Note: See TracBrowser for help on using the repository browser.