Biblioteca Java - Blame information for rev 25
Subversion Repositories:
Rev | Author | Line No. | Line |
---|---|---|---|
25 | mihai | 1 | import java.util.Observable; |
2 | |||
3 | public class Fir extends Observable implements Runnable { | ||
4 | int id; | ||
5 | int c; | ||
6 | int processorLoad; | ||
7 | Thread t; | ||
8 | |||
9 | Fir(int id, int priority, int procLoad) { | ||
10 | this.id = id; | ||
11 | t = new Thread(this); | ||
12 | t.setPriority(priority); | ||
13 | t.start(); | ||
14 | System.out.println("Started "+t.getName()); | ||
15 | this.processorLoad = procLoad; | ||
16 | |||
17 | } | ||
18 | |||
19 | public String getName(){ | ||
20 | return t.getName(); | ||
21 | } | ||
22 | |||
23 | public void run() { | ||
24 | |||
25 | while (c < 1000) { | ||
26 | for (int j = 0; j < this.processorLoad; j++) { | ||
27 | j++; | ||
28 | j--; | ||
29 | } | ||
30 | c++; | ||
31 | this.setChanged(); | ||
32 | this.notifyObservers(); | ||
33 | } | ||
34 | } | ||
35 | } |