diff options
author | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2015-05-11 14:56:49 +0200 |
---|---|---|
committer | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2015-05-19 12:00:48 +0200 |
commit | aa05cfbb3d6309ec45b69f34d0870465fe30b74c (patch) | |
tree | e004fe884c7018b81bf430b095af350b66f86f6f /cpukit/rtems/src | |
parent | score: Add static initializers for thread queues (diff) | |
download | rtems-aa05cfbb3d6309ec45b69f34d0870465fe30b74c.tar.bz2 |
score: Replace _Thread_Delay_ended()
Use _Thread_Timeout() instead. Use pseudo thread queue for nanosleep()
to deal with signals.
Close #2130.
Diffstat (limited to 'cpukit/rtems/src')
-rw-r--r-- | cpukit/rtems/src/taskwakeafter.c | 10 | ||||
-rw-r--r-- | cpukit/rtems/src/taskwakewhen.c | 8 |
2 files changed, 11 insertions, 7 deletions
diff --git a/cpukit/rtems/src/taskwakeafter.c b/cpukit/rtems/src/taskwakeafter.c index 6f0322723a..b7f328f5bc 100644 --- a/cpukit/rtems/src/taskwakeafter.c +++ b/cpukit/rtems/src/taskwakeafter.c @@ -30,23 +30,25 @@ rtems_status_code rtems_task_wake_after( * It is critical to obtain the executing thread after thread dispatching is * disabled on SMP configurations. */ - Thread_Control *executing; + Thread_Control *executing; + Per_CPU_Control *cpu_self; - _Thread_Disable_dispatch(); + cpu_self = _Thread_Dispatch_disable(); executing = _Thread_Executing; if ( ticks == 0 ) { _Thread_Yield( executing ); } else { _Thread_Set_state( executing, STATES_DELAYING ); + _Thread_Wait_flags_set( executing, THREAD_WAIT_STATE_BLOCKED ); _Watchdog_Initialize( &executing->Timer, - _Thread_Delay_ended, + _Thread_Timeout, 0, executing ); _Watchdog_Insert_ticks( &executing->Timer, ticks ); } - _Thread_Enable_dispatch(); + _Thread_Dispatch_enable( cpu_self ); return RTEMS_SUCCESSFUL; } diff --git a/cpukit/rtems/src/taskwakewhen.c b/cpukit/rtems/src/taskwakewhen.c index a1fc15f047..cf0b303cd3 100644 --- a/cpukit/rtems/src/taskwakewhen.c +++ b/cpukit/rtems/src/taskwakewhen.c @@ -30,6 +30,7 @@ rtems_status_code rtems_task_wake_when( { Watchdog_Interval seconds; Thread_Control *executing; + Per_CPU_Control *cpu_self; if ( !_TOD_Is_set() ) return RTEMS_NOT_DEFINED; @@ -47,12 +48,13 @@ rtems_status_code rtems_task_wake_when( if ( seconds <= _TOD_Seconds_since_epoch() ) return RTEMS_INVALID_CLOCK; - _Thread_Disable_dispatch(); + cpu_self = _Thread_Dispatch_disable(); executing = _Thread_Executing; _Thread_Set_state( executing, STATES_WAITING_FOR_TIME ); + _Thread_Wait_flags_set( executing, THREAD_WAIT_STATE_BLOCKED ); _Watchdog_Initialize( &executing->Timer, - _Thread_Delay_ended, + _Thread_Timeout, 0, executing ); @@ -60,6 +62,6 @@ rtems_status_code rtems_task_wake_when( &executing->Timer, seconds - _TOD_Seconds_since_epoch() ); - _Thread_Enable_dispatch(); + _Thread_Dispatch_enable( cpu_self ); return RTEMS_SUCCESSFUL; } |