X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=TD1%2Fexo3%2FProducteur.java;h=5e09d5062cf9ebb1cad47860e89dfe53aa59ec58;hb=HEAD;hp=36b67a316b4153b29d7a2c69b08d87823f7ef56f;hpb=e018d1ec033513412d9b3628a7d6701a48725382;p=TD_SR.git diff --git a/TD1/exo3/Producteur.java b/TD1/exo3/Producteur.java index 36b67a3..5e09d50 100644 --- a/TD1/exo3/Producteur.java +++ b/TD1/exo3/Producteur.java @@ -11,19 +11,19 @@ public class Producteur implements Runnable { buffer = b; } - public Producteur(BufferCirc b, String name) { + public Producteur(BufferCirc b, Thread th, String name) { buffer = b; - setThName(name); + setThName(th, name); } - public void setThName(String name) { - Thread.currentThread().setName(name); + public void setThName(Thread th, String name) { + th.setName(name); } public void run() { while (true) { buffer.depose(new Integer(val)); - System.out.println(Thread.currentThread().getName() + " a depose " + val); + System.out.println(Thread.currentThread().getName() + " a depose " + val); val++; try { Thread.sleep(ThreadLocalRandom.current().nextInt(101));