Commit | Line | Data |
---|---|---|
18eb400b JB |
1 | |
2 | import java.util.ArrayList; | |
3 | ||
4 | ||
5 | public class Main { | |
6 | ||
7 | ||
8 | public static void main (String[] args) { | |
e018d1ec | 9 | //FIXME: Implement the args parsing to set the three values dynamically |
18eb400b JB |
10 | final int BUFFER_SIZE = 1; |
11 | final int PROD_NUMBER = 20; | |
12 | final int CONS_NUMBER = 20; | |
13 | BufferCirc b = new BufferCirc(BUFFER_SIZE); | |
14 | Thread[] P = new Thread[PROD_NUMBER]; | |
15 | Thread[] C = new Thread[CONS_NUMBER]; | |
16 | for (int i = 0; i < P.length; i++) { | |
17 | P[i] = new Thread(new Producteur(b)); | |
18 | P[i].setName("P" + i); | |
19 | P[i].start(); | |
20 | } | |
21 | for (int i = 0; i < C.length; i++) { | |
22 | C[i] = new Thread(new Consommateur(b)); | |
23 | C[i].setName("C" + i); | |
24 | C[i].start(); | |
25 | } | |
26 | } | |
27 | ||
28 | } |