
Sowas wie das hier müsste doch auch funktionieren, oder nicht? Empfände ich persönlich als hübschere Lösung.
Code: Alles auswählen
bool enterCritical = true;
active proctype P() {
do :: printf ("P non -critical action\n");
atomic {
enterCritical;
enterCritical = false
}
/* begin critical section */
printf ("P uses shared resource\n");
/* end critical section */
enterCritical = true
od
}
active proctype Q() { analogous }