Mercurial > hg > Database > Alice
view src/main/java/alice/test/concurrent/StartConcurrent.java @ 345:8f71c3e6f11d
Change directory structure Maven standard
author | sugi |
---|---|
date | Wed, 16 Apr 2014 18:26:07 +0900 |
parents | |
children | aefbe41fcf12 |
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"); for (int i = 0; i < threadNum; i++) { SleepCodeSegment cs2 = new SleepCodeSegment(i); cs2.ds1.setKey("wait"); } for (int i = 0; i < threadNum; i++) { ods.put("local", "wait", ValueFactory.createNilValue()); } } }