Fix thread_yield() on MSP430 platforms

Avoid race conditions that can cause crash on MSP430 platforms, when interruptions prevent thread context switching from being correctlty done.