X-Git-Url: https://codewiz.org/gitweb?a=blobdiff_plain;f=kern%2Fproc.c;h=5290c2c5129d6095cf2d9a0aca2a9ce192123b1c;hb=139052d58a99cc47e0e2ac6b897a0c26a0105c2a;hp=f28b9819fa88e3d3251c427e2df318efa352475c;hpb=d00ca36c2068d8b3099e956d59fcc314bf4b21b4;p=bertos.git diff --git a/kern/proc.c b/kern/proc.c index f28b9819..5290c2c5 100644 --- a/kern/proc.c +++ b/kern/proc.c @@ -264,12 +264,18 @@ void proc_schedule(void) * are idle-spinning, we must allow interrupts, otherwise no * process will ever wake up. * + * During idle-spinning, can occur an interrupt, it may be able to + * modify \p ProcReadyList. To ensure that compiler reload this + * variable every while cycle we call CPU_MEMORY_BARRIER. + * The memory barrier ensure that all variables used in this context + * are reloaded. * \todo If there was a way to write sig_wait() so that it does not * disable interrupts while waiting, there would not be any * reason to do this. */ IRQ_ENABLE; CPU_IDLE; + CPU_MEMORY_BARRIER; IRQ_DISABLE; } IRQ_RESTORE(flags);