Executes nested tasks in parallel.
Parallel tasks have a number of uses in a Phing build file including:
Taking advantage of available processing resources to execute external programs simultaneously.
Testing servers, where the server can be run in one thread and the test harness is run in another thread.
Any valid Phing task may be embedded within a parallel task, including other parallel tasks.
While the tasks within the parallel task are being run, the main thread will be blocked waiting for all the child threads to complete.
If one of the tasks within the parallel
task fails, the remaining tasks will continue to run until all tasks have completed.
In this situation, the parallel task will also fail.
The threadCount attribute can be used to place a maximum number of available threads for the execution. When not present the value is based on the number of processors present. When present then the maximum number of concurrently executing tasks will not exceed the number of threads specified. Furthermore, each task will be started in the order they are given. But no guarantee is made as to the speed of execution or the order of completion of the tasks, only that each will be started before the next.
This task is highly experimental, and will only work on *nix machines
that have the PHP pcntl
extension installed.
In some cases, such as when running this task from the Phing's .phar
bundle,
stability issues can occur. See this issue
for more details.
Table C.80: Attributes
Name | Type | Description | Default | Required |
---|---|---|---|---|
threadCount | Integer | Maximum number of threads / processes to use. | n/a | No |