ThinkChat2.0新版上线,更智能更精彩,支持会话、画图、阅读、搜索等,送10W Token,即刻开启你的AI之旅 广告
# C.61 ParallelTask 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. ### Warning This task is highly experimental, and will only work on \*nix machines that have the PHP `pcntl` extension installed. Table C.72:聽Attributes NameTypeDescriptionDefaultRequired`threadCount``Integer`Maximum number of threads / processes to use.n/aNo C.61.1 Example ``` <parallel threadCount="4"> <echo>Job 1</echo> <echo>Job 2</echo> <echo>Job 3</echo> <echo>Job 4</echo> </parallel> ```