source: rtems/c/src/exec/rtems/src/taskissuspended.c @ 4a4efb5

4.104.114.84.95
Last change on this file since 4a4efb5 was 4a4efb5, checked in by Joel Sherrill <joel.sherrill@…>, on 10/07/99 at 16:26:31

New directive added -- rtems_task_is_suspended.

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