master
Kanken6174 2 years ago
parent a64bb3c6b4
commit 57ef74646f

@ -6,7 +6,8 @@ public class Main3B {
ThreadWeaver tw = new ThreadWeaver();
Boulangerie b = new BoulangerieThreadSafe();
Patissier p = new Patissier(b);
tw.addRunners(p, new Client(b));
Client c1 = new Client(b);
tw.addRunners(p, c1);
tw.weave();
tw.run();
@ -16,6 +17,7 @@ public class Main3B {
throw new RuntimeException(e);
}
p.shouldRun.set(false);
tw.recover();
}
}

@ -16,7 +16,7 @@ public class PatissierSuicidal extends Patissier {
@Override
public void run() {
while(shouldRun.get()) {
for(int i = 0; i < 20; i++) {
if(!local.depose(new Patisserie())){
shouldRun.set(false);
}

Loading…
Cancel
Save