if the thread_yeild function is called from within an ISR, then when does the program exit the ISR. Does the scheduler make sure that we exit the ISR before running the new thread or do we continue to be in the ISR?
the situation for the cortex-mx platforms is sligthly more complicated:
The `thread_yield()` call tells the controller to trigger the PendSV interrupt. This ISR has the property, that it is executed after all (higher prioritized) active interrupts are serviced first. In the PendSV handler the actual context switching takes place and the controller is then put back into `normal` thread mode (see `thread_arch.c` in the `cortex-mX_common` folders`. But I guess the effect stays the same: calling `thread_yield()` will trigger a context switch (if applicable) and the resulting thread is always run in non-interrupt mode.