+/EE360P

distributed systems

git clone https://git.julia.blue/+/EE360P

Wei-Lun Hungadd chap. 2 and 3df69975

master
321 B10 linesraw
1class Attempt2 implements Lock {
2    boolean wantCS[] = {false, false};
3    public void requestCS(int i) { // entry protocol @\label{want}@
4        wantCS[i] = true;   //declare intent @\label{busy}@
5        while (wantCS[1 - i]) ; // busy wait
6    }
7    public void releaseCS(int i) {
8        wantCS[i] = false;
9    }
10}