4.115
Last change
on this file since aa05cfbb was
aa05cfbb,
checked in by Sebastian Huber <sebastian.huber@…>, on 05/11/15 at 12:56:49
|
score: Replace _Thread_Delay_ended()
Use _Thread_Timeout() instead. Use pseudo thread queue for nanosleep()
to deal with signals.
Close #2130.
|
-
Property mode set to
100644
|
File size:
1.2 KB
|
Line | |
---|
1 | /** |
---|
2 | * @file |
---|
3 | * |
---|
4 | * @brief RTEMS Task Wake After |
---|
5 | * @ingroup ClassicTasks |
---|
6 | */ |
---|
7 | |
---|
8 | /* |
---|
9 | * COPYRIGHT (c) 1989-1999. |
---|
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.org/license/LICENSE. |
---|
15 | */ |
---|
16 | |
---|
17 | #if HAVE_CONFIG_H |
---|
18 | #include "config.h" |
---|
19 | #endif |
---|
20 | |
---|
21 | #include <rtems/rtems/tasks.h> |
---|
22 | #include <rtems/score/threadimpl.h> |
---|
23 | #include <rtems/score/watchdogimpl.h> |
---|
24 | |
---|
25 | rtems_status_code rtems_task_wake_after( |
---|
26 | rtems_interval ticks |
---|
27 | ) |
---|
28 | { |
---|
29 | /* |
---|
30 | * It is critical to obtain the executing thread after thread dispatching is |
---|
31 | * disabled on SMP configurations. |
---|
32 | */ |
---|
33 | Thread_Control *executing; |
---|
34 | Per_CPU_Control *cpu_self; |
---|
35 | |
---|
36 | cpu_self = _Thread_Dispatch_disable(); |
---|
37 | executing = _Thread_Executing; |
---|
38 | |
---|
39 | if ( ticks == 0 ) { |
---|
40 | _Thread_Yield( executing ); |
---|
41 | } else { |
---|
42 | _Thread_Set_state( executing, STATES_DELAYING ); |
---|
43 | _Thread_Wait_flags_set( executing, THREAD_WAIT_STATE_BLOCKED ); |
---|
44 | _Watchdog_Initialize( |
---|
45 | &executing->Timer, |
---|
46 | _Thread_Timeout, |
---|
47 | 0, |
---|
48 | executing |
---|
49 | ); |
---|
50 | _Watchdog_Insert_ticks( &executing->Timer, ticks ); |
---|
51 | } |
---|
52 | _Thread_Dispatch_enable( cpu_self ); |
---|
53 | return RTEMS_SUCCESSFUL; |
---|
54 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.