Mercurial > hg > Database > Alice
view src/main/java/alice/test/concurrent/StartConcurrent.java @ 547:e91a574b69de dispose
remove index
author | Nozomi Teruya <e125769@ie.u-ryukyu.ac.jp> |
---|---|
date | Tue, 18 Aug 2015 16:15:17 +0900 |
parents | 15eeb439830c |
children |
line wrap: on
line source
package alice.test.concurrent; import org.msgpack.type.ValueFactory; import alice.codesegment.CodeSegment; public class StartConcurrent extends CodeSegment { private int count; public StartConcurrent(int count) { this.count = count; } @Override public void run() { int threadNum = Runtime.getRuntime().availableProcessors() * count; AliceFinish cs1 = new AliceFinish(threadNum); cs1.ds1.setKey("finish", this); for (int i = 0; i < threadNum; i++) { SleepCodeSegment cs2 = new SleepCodeSegment(i); cs2.ds1.setKey("wait", this); } for (int i = 0; i < threadNum; i++) { ods.put("local", "wait", ValueFactory.createNilValue()); } } }