source:
rtems/cpukit/rtems/src/tasksuspend.c
@
17bbadd
Last change on this file since 17bbadd was 17bbadd, checked in by Joel Sherrill <joel.sherrill@…>, on 05/06/04 at 19:20:04 | |
---|---|
|
|
File size: 2.0 KB |
Line | |
---|---|
1 | /* |
2 | * RTEMS Task Manager |
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 the file LICENSE in this distribution or at |
10 | * http://www.rtems.com/license/LICENSE. |
11 | * |
12 | * $Id$ |
13 | */ |
14 | |
15 | #include <rtems/system.h> |
16 | #include <rtems/rtems/status.h> |
17 | #include <rtems/rtems/support.h> |
18 | #include <rtems/rtems/modes.h> |
19 | #include <rtems/score/object.h> |
20 | #include <rtems/score/stack.h> |
21 | #include <rtems/score/states.h> |
22 | #include <rtems/rtems/tasks.h> |
23 | #include <rtems/score/thread.h> |
24 | #include <rtems/score/threadq.h> |
25 | #include <rtems/score/tod.h> |
26 | #include <rtems/score/userext.h> |
27 | #include <rtems/score/wkspace.h> |
28 | #include <rtems/score/apiext.h> |
29 | #include <rtems/score/sysstate.h> |
30 | |
31 | /*PAGE |
32 | * |
33 | * rtems_task_suspend |
34 | * |
35 | * This directive will place the specified thread in the "suspended" |
36 | * state. Note that the suspended state can be in addition to |
37 | * other waiting states. |
38 | * |
39 | * Input parameters: |
40 | * id - thread id |
41 | * |
42 | * Output parameters: |
43 | * RTEMS_SUCCESSFUL - if successful |
44 | * error code - if unsuccessful |
45 | */ |
46 | |
47 | rtems_status_code rtems_task_suspend( |
48 | Objects_Id id |
49 | ) |
50 | { |
51 | register Thread_Control *the_thread; |
52 | Objects_Locations location; |
53 | |
54 | the_thread = _Thread_Get( id, &location ); |
55 | switch ( location ) { |
56 | |
57 | case OBJECTS_REMOTE: |
58 | #if defined(RTEMS_MULTIPROCESSING) |
59 | return _RTEMS_tasks_MP_Send_request_packet( |
60 | RTEMS_TASKS_MP_SUSPEND_REQUEST, |
61 | id, |
62 | 0, /* Not used */ |
63 | 0, /* Not used */ |
64 | 0 /* Not used */ |
65 | ); |
66 | #endif |
67 | |
68 | case OBJECTS_ERROR: |
69 | return RTEMS_INVALID_ID; |
70 | |
71 | case OBJECTS_LOCAL: |
72 | if ( !_States_Is_suspended( the_thread->current_state ) ) { |
73 | _Thread_Suspend( the_thread ); |
74 | _Thread_Enable_dispatch(); |
75 | return RTEMS_SUCCESSFUL; |
76 | } |
77 | _Thread_Enable_dispatch(); |
78 | return RTEMS_ALREADY_SUSPENDED; |
79 | } |
80 | |
81 | return RTEMS_INTERNAL_ERROR; /* unreached - only to remove warnings */ |
82 | } |
Note: See TracBrowser
for help on using the repository browser.