-
Notifications
You must be signed in to change notification settings - Fork 12
Expand file tree
/
Copy pathGoldilocksState.java
More file actions
47 lines (35 loc) · 1.29 KB
/
GoldilocksState.java
File metadata and controls
47 lines (35 loc) · 1.29 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
package engine.racedetectionengine.goldilocks;
import java.util.HashMap;
import java.util.HashSet;
import engine.racedetectionengine.State;
import event.Lock;
import event.Thread;
import event.Variable;
public class GoldilocksState extends State {
// Data for the algorithm data
public HashMap<Variable, HashSet<Lock>> writeLockSet;
// public HashMap<Variable, HashSet<Thread>> writeThreadSet;
public HashMap<Lock, HashMap<Variable, HashSet<Lock>>> readLockSet;
// public HashMap<Thread, HashMap<Variable, HashSet<Thread>>> readThreadSet;
public HashMap<Thread, Lock> threadLocks;
public int verbosity;
public GoldilocksState(HashSet<Thread> tSet, int verbosity) {
this.verbosity = verbosity;
initData(tSet);
}
public void initData(HashSet<Thread> tSet) {
writeLockSet = new HashMap<Variable, HashSet<Lock>> ();
// writeThreadSet = new HashMap<Variable, HashSet<Thread>> ();
readLockSet = new HashMap<Lock, HashMap<Variable, HashSet<Lock>>> ();
// readThreadSet = new HashMap<Thread, HashMap<Variable, HashSet<Thread>>> ();
this.threadLocks = new HashMap<Thread, Lock> ();
for(Thread t: tSet){
Lock tLock = new Lock("ThreadLock-" + t.getName());
this.threadLocks.put(t, tLock);
}
}
@Override
public void printMemory() {
System.out.println("Dummy method called");
}
}