-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMain.java
More file actions
18 lines (18 loc) · 742 Bytes
/
Main.java
File metadata and controls
18 lines (18 loc) · 742 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
public class Main{
public static void main(String[] args) {
int m = 10, p = 10, c = 10;
NoticiaMonitor monitorNoticias = new NoticiaMonitor(m, p, c);
Thread[] consumidores = new Thread[c];
Thread[] produtores = new Thread[p];
for (int i = 0; i < produtores.length; i++) {
produtores[i] = new Thread(new Produtor(monitorNoticias), ""+i);
produtores[i].start();
}
for (int i = 0; i < consumidores.length; i++) {
consumidores[i] = new Thread(new Consumidor(monitorNoticias));
consumidores[i].start();
}
long t1 = System.currentTimeMillis();
while (true) if(System.currentTimeMillis() - t1 == 15000) break;
}
}