summaryrefslogtreecommitdiffstats
path: root/cpukit/rtems/src/taskwakeafter.c
diff options
context:
space:
mode:
authorSebastian Huber <sebastian.huber@embedded-brains.de>2013-06-10 16:15:46 +0200
committerSebastian Huber <sebastian.huber@embedded-brains.de>2013-06-14 16:26:08 +0200
commit6eba7c857b9e72bc4ed8e55f0c9538c45631484f (patch)
tree09847feda8d2183412ab57d59602b3f08481d2ae /cpukit/rtems/src/taskwakeafter.c
parentscheduler: Add start idle thread operation (diff)
downloadrtems-6eba7c857b9e72bc4ed8e55f0c9538c45631484f.tar.bz2
scheduler: Specify thread of yield operation
The yielding thread of the yield operation is now specified by a parameter. The tick operation may be performed for each executing thread in a SMP configuration.
Diffstat (limited to 'cpukit/rtems/src/taskwakeafter.c')
-rw-r--r--cpukit/rtems/src/taskwakeafter.c18
1 files changed, 13 insertions, 5 deletions
diff --git a/cpukit/rtems/src/taskwakeafter.c b/cpukit/rtems/src/taskwakeafter.c
index 1df86553f8..665423409b 100644
--- a/cpukit/rtems/src/taskwakeafter.c
+++ b/cpukit/rtems/src/taskwakeafter.c
@@ -38,18 +38,26 @@ rtems_status_code rtems_task_wake_after(
rtems_interval ticks
)
{
+ /*
+ * It is critical to obtain the executing thread after thread dispatching is
+ * disabled on SMP configurations.
+ */
+ Thread_Control *executing;
+
_Thread_Disable_dispatch();
+ executing = _Thread_Executing;
+
if ( ticks == 0 ) {
- _Scheduler_Yield();
+ _Scheduler_Yield( executing );
} else {
- _Thread_Set_state( _Thread_Executing, STATES_DELAYING );
+ _Thread_Set_state( executing, STATES_DELAYING );
_Watchdog_Initialize(
- &_Thread_Executing->Timer,
+ &executing->Timer,
_Thread_Delay_ended,
- _Thread_Executing->Object.id,
+ executing->Object.id,
NULL
);
- _Watchdog_Insert_ticks( &_Thread_Executing->Timer, ticks );
+ _Watchdog_Insert_ticks( &executing->Timer, ticks );
}
_Thread_Enable_dispatch();
return RTEMS_SUCCESSFUL;