mirror of
https://github.com/mruby/mruby
synced 2026-06-08 16:11:16 +00:00
030a08092a
Bug scenario: * VM returns an Exception `t->state.result = mrb_vm_exec(...);` * Despite task is still MRB_TASK_STATUS_RUNNING, IRQ triggered by chance and `mrb_tick()` executes `t->state.timeslice--;` * But the same memory area already holds the `result`, `timeslice--` reduces `result.value.p`'s top byte The fix is to separate `timeslice` and `result` into different fields. I have considered improving critical sections, but I ended up with this patch because I believe it is widely effective and less error-prone.