Browse Source

In bug 32566 someone asked about the thread safety requirements in Ant.

This made me perform a quick check on the main flow of the Ant project
from a threading perspective. The only cause for wich the tasks specified
in the build file may be executed in another thread is the parallel task.
The parallel task does not ensure all variables are stored in memory before
the new threads start.


git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@277154 13f79535-47bb-0310-9956-ffa450edef68
master
Jacobus Martinus Kruithof 20 years ago
parent
commit
411673fe34
1 changed files with 8 additions and 0 deletions
  1. +8
    -0
      src/main/org/apache/tools/ant/taskdefs/Parallel.java

+ 8
- 0
src/main/org/apache/tools/ant/taskdefs/Parallel.java View File

@@ -265,6 +265,14 @@ public class Parallel extends Task
daemons = new TaskRunnable[daemonTasks.tasks.size()];
}

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) {


Loading…
Cancel
Save