source:
rtems/cpukit/rtems/src/taskwakeafter.c
@
d78d529
Last change on this file since d78d529 was d78d529, checked in by Sebastian Huber <sebastian.huber@…>, on 11/14/16 at 08:11:07 | |
---|---|
|
|
File size: 1.2 KB |
Rev | Line | |
---|---|---|
[52adc808] | 1 | /** |
2 | * @file | |
[c4d69e2] | 3 | * |
[52adc808] | 4 | * @brief RTEMS Task Wake After |
5 | * @ingroup ClassicTasks | |
6 | */ | |
7 | ||
8 | /* | |
[08311cc3] | 9 | * COPYRIGHT (c) 1989-1999. |
[c4d69e2] | 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 | |
[c499856] | 14 | * http://www.rtems.org/license/LICENSE. |
[c4d69e2] | 15 | */ |
16 | ||
[1095ec1] | 17 | #if HAVE_CONFIG_H |
18 | #include "config.h" | |
19 | #endif | |
20 | ||
[5618c37a] | 21 | #include <rtems/rtems/tasks.h> |
22 | #include <rtems/score/threadimpl.h> | |
[4b48ece0] | 23 | #include <rtems/score/watchdogimpl.h> |
[c4d69e2] | 24 | |
25 | rtems_status_code rtems_task_wake_after( | |
26 | rtems_interval ticks | |
27 | ) | |
28 | { | |
[6eba7c85] | 29 | /* |
30 | * It is critical to obtain the executing thread after thread dispatching is | |
31 | * disabled on SMP configurations. | |
32 | */ | |
[aa05cfbb] | 33 | Thread_Control *executing; |
34 | Per_CPU_Control *cpu_self; | |
[6eba7c85] | 35 | |
[aa05cfbb] | 36 | cpu_self = _Thread_Dispatch_disable(); |
[6eba7c85] | 37 | executing = _Thread_Executing; |
38 | ||
[c4d69e2] | 39 | if ( ticks == 0 ) { |
[701dd96f] | 40 | _Thread_Yield( executing ); |
[c4d69e2] | 41 | } else { |
[6eba7c85] | 42 | _Thread_Set_state( executing, STATES_DELAYING ); |
[aa05cfbb] | 43 | _Thread_Wait_flags_set( executing, THREAD_WAIT_STATE_BLOCKED ); |
[03b900d] | 44 | _Thread_Timer_insert_relative( |
45 | executing, | |
46 | cpu_self, | |
[aa05cfbb] | 47 | _Thread_Timeout, |
[03b900d] | 48 | ticks |
[c4d69e2] | 49 | ); |
50 | } | |
[d78d529] | 51 | _Thread_Dispatch_direct( cpu_self ); |
[c4d69e2] | 52 | return RTEMS_SUCCESSFUL; |
53 | } |
Note: See TracBrowser
for help on using the repository browser.