mcs: use local variable in restart

This eases verification by using a local variable
which remains unchanged during execution of the
function.

This preserves semantics since refill_unblock_check
will not modify the tcbSchedContext field of any TCB.

Signed-off-by: Michael McInerney <michael.mcinerney@proofcraft.systems>
This commit is contained in:
Michael McInerney
2026-02-25 11:53:18 +10:30
committed by Gerwin Klein
parent b5cc70d753
commit efd9426e17

View File

@@ -93,11 +93,11 @@ void restart(tcb_t *target)
cancelIPC(target);
#ifdef CONFIG_KERNEL_MCS
setThreadState(target, ThreadState_Restart);
if (sc_sporadic(target->tcbSchedContext)
&& target->tcbSchedContext != NODE_STATE(ksCurSC)) {
refill_unblock_check(target->tcbSchedContext);
sched_context_t *sc = target->tcbSchedContext;
if (sc_sporadic(sc) && sc != NODE_STATE(ksCurSC)) {
refill_unblock_check(sc);
}
schedContext_resume(target->tcbSchedContext);
schedContext_resume(sc);
if (isSchedulable(target)) {
possibleSwitchTo(target);
}