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.OARcorp.com/rtems/license.html. |
---|
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_wake_after |
---|
34 | * |
---|
35 | * This directive suspends the requesting thread for the given amount |
---|
36 | * of ticks. |
---|
37 | * |
---|
38 | * Input parameters: |
---|
39 | * ticks - number of ticks to wait |
---|
40 | * |
---|
41 | * Output parameters: |
---|
42 | * RTEMS_SUCCESSFUL - always successful |
---|
43 | */ |
---|
44 | |
---|
45 | rtems_status_code rtems_task_wake_after( |
---|
46 | rtems_interval ticks |
---|
47 | ) |
---|
48 | { |
---|
49 | _Thread_Disable_dispatch(); |
---|
50 | if ( ticks == 0 ) { |
---|
51 | _Thread_Yield_processor(); |
---|
52 | } else { |
---|
53 | _Thread_Set_state( _Thread_Executing, STATES_DELAYING ); |
---|
54 | _Watchdog_Initialize( |
---|
55 | &_Thread_Executing->Timer, |
---|
56 | _Thread_Delay_ended, |
---|
57 | _Thread_Executing->Object.id, |
---|
58 | NULL |
---|
59 | ); |
---|
60 | _Watchdog_Insert_ticks( &_Thread_Executing->Timer, ticks ); |
---|
61 | } |
---|
62 | _Thread_Enable_dispatch(); |
---|
63 | return RTEMS_SUCCESSFUL; |
---|
64 | } |
---|