source: rtems/cpukit/rtems/src/tasksuspend.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.6 KB
Line 
1/**
2 *  @file
3 *
4 *  @brief RTEMS Suspend Task
5 *  @ingroup ClassicTasks
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
35rtems_status_code rtems_task_suspend(
36  rtems_id id
37)
38{
39  register Thread_Control *the_thread;
40  Objects_Locations        location;
41
42  the_thread = _Thread_Get( id, &location );
43  switch ( location ) {
44
45    case OBJECTS_LOCAL:
46      if ( !_States_Is_suspended( the_thread->current_state ) ) {
47        _Thread_Suspend( the_thread );
48        _Objects_Put( &the_thread->Object );
49        return RTEMS_SUCCESSFUL;
50      }
51      _Objects_Put( &the_thread->Object );
52      return RTEMS_ALREADY_SUSPENDED;
53
54#if defined(RTEMS_MULTIPROCESSING)
55    case OBJECTS_REMOTE:
56      return _RTEMS_tasks_MP_Send_request_packet(
57        RTEMS_TASKS_MP_SUSPEND_REQUEST,
58        id,
59        0,          /* Not used */
60        0,          /* Not used */
61        0           /* Not used */
62      );
63#endif
64
65    case OBJECTS_ERROR:
66      break;
67  }
68
69  return RTEMS_INVALID_ID;
70}
Note: See TracBrowser for help on using the repository browser.