Commit | Line | Data |
---|---|---|
396bc743 JB |
1 | \r |
2 | \r | |
3 | public class Producteur implements Runnable {\r | |
4 | \r | |
5 | private BufferCirc buffer;\r | |
6 | private int val;\r | |
7 | \r | |
8 | \r | |
9 | public Producteur(BufferCirc b) {\r | |
10 | buffer = b;\r | |
11 | }\r | |
12 | \r | |
13 | \r | |
14 | public void run() {\r | |
15 | while (true) {\r | |
16 | buffer.depose(new Integer(val));\r | |
17 | System.out.println (Thread.currentThread().getName() + " a depose " + val);\r | |
18 | val++;\r | |
19 | try {\r | |
20 | Thread.sleep((int)(Math.random()*100));\r | |
21 | }\r | |
22 | catch (InterruptedException e) {}\r | |
23 | }\r | |
24 | }\r | |
25 | \r | |
26 | } // fin classe Producteur\r |