Skip to content

Commit

Permalink
scheduler - bugfix for forkjoin main, off-by-one in argument processing
Browse files Browse the repository at this point in the history
  • Loading branch information
lytles@takashi committed Oct 26, 2018
1 parent f97ec00 commit ebe1986
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/kilim/ForkJoinScheduler.java
Expand Up @@ -115,7 +115,8 @@ private static void run(String className,String method,String ... args) throws E
/** run the main method from another class using this scheduler as the default scheduler */
public static void main(String[] args) throws Exception {
Integer numThreads = parseNum(args,0);
if (args.length < 2 | numThreads != null & args.length < 3) {
int offset = numThreads==null ? 0:1;
if (args.length <= offset) {
System.out.println(
"usage:\n"
+ " java kilim.ForkJoinScheduler [numThreads] class [args]\n"
Expand All @@ -127,9 +128,9 @@ public static void main(String[] args) throws Exception {
int num = numThreads==null || numThreads <= 0 ? Scheduler.defaultNumberThreads : numThreads;
Scheduler sched = new ForkJoinScheduler(num);
Scheduler.setDefaultScheduler(sched);
String className = args[1];
args = processArgs(args,2);
run(className,"main",args);
String className = args[offset];
String [] pargs = processArgs(args,offset+1);
run(className,"main",pargs);
}

}

0 comments on commit ebe1986

Please sign in to comment.