Skip to content

Commit

Permalink
mcs: use local variable in postpone
Browse files Browse the repository at this point in the history
This eases verification by using a local variable
which remains unchanged during execution of the
function.

This preserves semantics since tcbSchedDequeue
will not modify the scTcb field of the given sc.

Signed-off-by: Michael McInerney <michael.mcinerney@proofcraft.systems>
  • Loading branch information
michaelmcinerney authored and lsf37 committed Jul 19, 2024
1 parent 1253115 commit c679fe7
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/kernel/thread.c
Original file line number Diff line number Diff line change
Expand Up @@ -567,8 +567,11 @@ void scheduleTCB(tcb_t *tptr)
#ifdef CONFIG_KERNEL_MCS
void postpone(sched_context_t *sc)
{
tcbSchedDequeue(sc->scTcb);
tcbReleaseEnqueue(sc->scTcb);
tcb_t *tcb = sc->scTcb;
assert(tcb != NULL);

tcbSchedDequeue(tcb);
tcbReleaseEnqueue(tcb);
NODE_STATE_ON_CORE(ksReprogram, sc->scCore) = true;
}

Expand Down

0 comments on commit c679fe7

Please sign in to comment.