X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=TD1%2Fexo3%2FProducteur.java;fp=TD1%2Fexo3%2FProducteur.java;h=10eab6d55ec99bc5e25278842a1b1a5e30a6a8a6;hb=396bc7433aa7fc3c404f2d175d1c93b82791cdde;hp=0000000000000000000000000000000000000000;hpb=b0f9b27c32d4599150eec0ce102695b328d87e7c;p=TD_SR.git diff --git a/TD1/exo3/Producteur.java b/TD1/exo3/Producteur.java new file mode 100644 index 0000000..10eab6d --- /dev/null +++ b/TD1/exo3/Producteur.java @@ -0,0 +1,26 @@ + + +public class Producteur implements Runnable { + + private BufferCirc buffer; + private int val; + + + public Producteur(BufferCirc b) { + buffer = b; + } + + + public void run() { + while (true) { + buffer.depose(new Integer(val)); + System.out.println (Thread.currentThread().getName() + " a depose " + val); + val++; + try { + Thread.sleep((int)(Math.random()*100)); + } + catch (InterruptedException e) {} + } + } + +} // fin classe Producteur