Elliott LE GUEHENNEC 2 years ago
commit 274abb7775

Binary file not shown.

Binary file not shown.

@ -6,7 +6,8 @@ public class Main3B {
ThreadWeaver tw = new ThreadWeaver(); ThreadWeaver tw = new ThreadWeaver();
Boulangerie b = new BoulangerieThreadSafe(); Boulangerie b = new BoulangerieThreadSafe();
Patissier p = new Patissier(b); Patissier p = new Patissier(b);
tw.addRunners(p, new Client(b)); Client c1 = new Client(b);
tw.addRunners(p, c1);
tw.weave(); tw.weave();
tw.run(); tw.run();
@ -15,7 +16,8 @@ public class Main3B {
} catch (InterruptedException e) { } catch (InterruptedException e) {
throw new RuntimeException(e); throw new RuntimeException(e);
} }
p.shouldRun.set(false); for(int i = 0; i < 900; i++)
b.depose(Gateau.GATEAU_EMPOISONNE);
tw.recover(); tw.recover();
} }
} }

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

Loading…
Cancel
Save