+/EE360P

distributed systems

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

Wei-Lun Hungadd chap. 2 and 3df69975

master
339 B14 linesraw
1class BCell { // can result in deadlocks
2    int value;
3    public synchronized int getValue() {
4        return value;
5    }
6    public synchronized void setValue(int i) {
7        value = i;
8    }
9    public synchronized void swap(BCell x) {
10        int temp = getValue();
11        setValue(x.getValue());
12        x.setValue(temp);
13    }
14}