jkf 2004/12/11 02:49:01 Modified: src/main/org/apache/tools/ant/taskdefs Tag: ANT_16_BRANCH Parallel.java Log: Sync Revision Changes Path No revision No revision 1.24.2.6 +23 -5 ant/src/main/org/apache/tools/ant/taskdefs/Parallel.java Index: Parallel.java =================================================================== RCS file: /home/cvs/ant/src/main/org/apache/tools/ant/taskdefs/Parallel.java,v retrieving revision 1.24.2.5 retrieving revision 1.24.2.6 diff -u -r1.24.2.5 -r1.24.2.6 --- Parallel.java 1 Apr 2004 13:07:34 -0000 1.24.2.5 +++ Parallel.java 11 Dec 2004 10:49:01 -0000 1.24.2.6 @@ -56,9 +56,10 @@ /** * Add a nested task to execute parallel (asynchron). * <p> - * @param nestedTask Nested task to be executed in parallel + * @param nestedTask Nested task to be executed in parallel. + * must not be null. */ - public void addTask(Task nestedTask) throws BuildException { + public void addTask(Task nestedTask) { tasks.add(nestedTask); } } @@ -107,6 +108,7 @@ /** * Add a group of daemon threads + * @param daemonTasks The tasks to be executed as daemon. */ public void addDaemons(TaskList daemonTasks) { if (this.daemonTasks != null) { @@ -266,6 +268,14 @@ } synchronized (semaphore) { + // When we leave this block we can be sure all data is really + // stored in main memory before the new threads start, the new + // threads will for sure load the data from main memory. + // + // This probably is slightly paranoid. + } + + synchronized (semaphore) { // start any daemon threads if (daemons != null) { for (int i = 0; i < daemons.length; ++i) { @@ -307,7 +317,7 @@ outer: while (threadNumber < numTasks && stillRunning) { for (int i = 0; i < maxRunning; i++) { - if (running[i] == null || running[i].finished) { + if (running[i] == null || running[i].isFinished()) { running[i] = runnables[threadNumber++]; Thread thread = new Thread(group, running[i]); thread.start(); @@ -332,7 +342,7 @@ outer2: while (stillRunning) { for (int i = 0; i < maxRunning; ++i) { - if (running[i] != null && !running[i].finished) { + if (running[i] != null && !running[i].isFinished()) { //System.out.println("Thread " + i + " is still alive "); // still running - wait for it try { @@ -397,7 +407,7 @@ private class TaskRunnable implements Runnable { private Throwable exception; private Task task; - boolean finished; + private boolean finished; /** * Construct a new TaskRunnable.<p> @@ -434,6 +444,14 @@ */ public Throwable getException() { return exception; + } + + /** + * Provides the indicator that the task has been finished. + * @return Returns true when the task is finished. + */ + boolean isFinished() { + return finished; } }
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]