Mercurial > hg > Database > Alice
view src/alice/test/concurrent/StartConcurrent.java @ 276:3e0d1ac4f4a8
Refactor iterating process with for-each sentence.
author | kazz <kazz@cr.ie.u-ryukyu.ac.jp> |
---|---|
date | Fri, 18 Oct 2013 01:51:15 +0900 |
parents | 481f322b3206 |
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"); 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()); } } }