Maintain legacy RTOS behavior before mbed-5
Fork of mbed-rtos by
Diff: rtx/TARGET_CORTEX_M/rt_Task.c
- Revision:
- 118:6635230e06ba
- Parent:
- 112:53ace74b190c
- Child:
- 123:58563e6cba1e
diff -r 4c105b8d7cae -r 6635230e06ba rtx/TARGET_CORTEX_M/rt_Task.c --- a/rtx/TARGET_CORTEX_M/rt_Task.c Mon May 23 11:00:15 2016 +0100 +++ b/rtx/TARGET_CORTEX_M/rt_Task.c Mon Jul 25 14:12:24 2016 +0100 @@ -40,6 +40,7 @@ #include "rt_MemBox.h" #include "rt_Robin.h" #include "rt_HAL_CM.h" +#include "rt_OsEventObserver.h" /*---------------------------------------------------------------------------- * Global Variables @@ -101,6 +102,9 @@ /* Switch to next task (identified by "p_new"). */ os_tsk.new_tsk = p_new; p_new->state = RUNNING; + if (osEventObs && osEventObs->thread_switch) { + osEventObs->thread_switch(p_new->context); + } DBG_TASK_SWITCH(p_new->task_id); } @@ -402,6 +406,10 @@ os_tsk.run = &os_idle_TCB; os_tsk.run->state = RUNNING; + /* Set the current thread to idle, so that on exit from this SVCall we do not + * de-reference a NULL TCB. */ + rt_switch_req(&os_idle_TCB); + /* Initialize ps queue */ os_psq->first = 0U; os_psq->last = 0U;