+/EE360P

distributed systems

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

Wei-Lun Hungadd chap. 2 and 3df69975

master
377 B15 linesraw
1public class BinarySemaphore {
2    boolean value;
3    public BinarySemaphore(boolean initValue) {
4        value = initValue;
5    }
6    public synchronized void P() {
7        while (value == false) 
8            Util.myWait(this);// in the queue of blocked processes
9        value = false;
10    }
11    public synchronized void V() {
12        value = true;
13        notify();
14    }
15}