345
|
1 package alice.test.concurrent;
|
|
2
|
|
3 import alice.codesegment.CodeSegment;
|
|
4 import alice.datasegment.CommandType;
|
|
5 import alice.datasegment.Receiver;
|
|
6
|
|
7 public class AliceFinish extends CodeSegment {
|
|
8
|
|
9 private int num;
|
|
10
|
|
11 public Receiver ds1 = ids.create(CommandType.TAKE);
|
|
12
|
|
13 public AliceFinish(int threadNum) {
|
|
14 this.num = threadNum;
|
|
15 }
|
|
16
|
|
17 @Override
|
|
18 public void run() {
|
|
19 if (--num == 0) System.exit(0);
|
|
20
|
|
21 AliceFinish cs1 = new AliceFinish(num);
|
|
22 cs1.ds1.setKey("finish");
|
|
23 }
|
|
24
|
|
25 }
|