Skip to content

Instantly share code, notes, and snippets.

@fujim2
Created January 18, 2020 08:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save fujim2/26afdf75cb84b01b144ac031546f1943 to your computer and use it in GitHub Desktop.
Save fujim2/26afdf75cb84b01b144ac031546f1943 to your computer and use it in GitHub Desktop.
var Thread0inside = 0;
var Thread1inside = 0;
ThreadZero() =
[!(Thread1inside == 1)]
T0Start
->CriticalSectionZero{Thread0inside = 1}
->T0End{Thread0inside = 0}
->OtherStuffZero
->ThreadZero();
ThreadOne() =
[!(Thread0inside == 1)]
T1Start
->CriticalSectionOne{Thread1inside = 1}
->T1End{Thread1inside = 0}
->OtherStuffOne
->ThreadOne();
System = ThreadZero() || ThreadOne();
#assert System deadlockfree;
#define badstatus (Thread0inside==1 && Thread1inside == 1);
#assert System reaches badstatus;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment