Mutex / critical section
Two competing threads share a single mutex token — only one can hold it at a time.
Make it your own.
title Mutex with two threads
place P1_Idle tokens 1 "Thread 1 idle"
place P2_Idle tokens 1 "Thread 2 idle"
place Mutex tokens 1 "Mutex"
transition T1_Acq "T1 acquire"
transition T2_Acq "T2 acquire"
place P1_Critical "T1 critical"
place P2_Critical "T2 critical"
transition T1_Rel "T1 release"
transition T2_Rel "T2 release"
P1_Idle -> T1_Acq
Mutex -> T1_Acq
T1_Acq -> P1_Critical
P1_Critical -> T1_Rel
T1_Rel -> Mutex
T1_Rel -> P1_Idle
P2_Idle -> T2_Acq
Mutex -> T2_Acq
T2_Acq -> P2_Critical
P2_Critical -> T2_Rel
T2_Rel -> Mutex
T2_Rel -> P2_Idle