source: rtems/cpukit/rtems/src/taskissuspended.c @ 39046f7

4.115
Last change on this file since 39046f7 was 39046f7, checked in by Sebastian Huber <sebastian.huber@…>, on 07/24/13 at 09:09:23

score: Merge sysstate API into one file

  • Property mode set to 100644
File size: 1.8 KB
Line 
1/**
2 * @file
3 *
4 * @brief rtems_task_is_suspended
5 * @ingroup ClassicTasks Tasks
6 */
7
8/*
9 *  COPYRIGHT (c) 1989-2007.
10 *  On-Line Applications Research Corporation (OAR).
11 *
12 *  The license and distribution terms for this file may be
13 *  found in the file LICENSE in this distribution or at
14 *  http://www.rtems.com/license/LICENSE.
15 */
16
17#if HAVE_CONFIG_H
18#include "config.h"
19#endif
20
21#include <rtems/system.h>
22#include <rtems/rtems/status.h>
23#include <rtems/rtems/support.h>
24#include <rtems/rtems/modes.h>
25#include <rtems/score/object.h>
26#include <rtems/score/stack.h>
27#include <rtems/score/states.h>
28#include <rtems/rtems/tasksimpl.h>
29#include <rtems/score/thread.h>
30#include <rtems/score/threadq.h>
31#include <rtems/score/tod.h>
32#include <rtems/score/wkspace.h>
33#include <rtems/score/apiext.h>
34
35/*
36 *  rtems_task_is_suspended
37 *
38 *  This directive returns a status indicating whether or not
39 *  the specified task is suspended.
40 *
41 *  Input parameters:
42 *    id - thread id
43 *
44 *  Output parameters:
45 *    RTEMS_SUCCESSFUL        - if successful and not suspended
46 *    RTEMS_ALREADY_SUSPENDED - if successful and suspended
47 *    error code              - if unsuccessful
48 */
49
50rtems_status_code rtems_task_is_suspended(
51  rtems_id id
52)
53{
54  register Thread_Control *the_thread;
55  Objects_Locations        location;
56
57  the_thread = _Thread_Get( id, &location );
58  switch ( location ) {
59
60    case OBJECTS_LOCAL:
61      if ( !_States_Is_suspended( the_thread->current_state ) ) {
62        _Objects_Put( &the_thread->Object );
63        return RTEMS_SUCCESSFUL;
64      }
65      _Objects_Put( &the_thread->Object );
66      return RTEMS_ALREADY_SUSPENDED;
67
68#if defined(RTEMS_MULTIPROCESSING)
69    case OBJECTS_REMOTE:
70      _Thread_Dispatch();
71      return RTEMS_ILLEGAL_ON_REMOTE_OBJECT;
72#endif
73
74    case OBJECTS_ERROR:
75      break;
76  }
77
78  return RTEMS_INVALID_ID;
79}
Note: See TracBrowser for help on using the repository browser.