我在这里找到了 GPars 中 fork/join 的示例:Fork/Join
import static groovyx.gpars.GParsPool.runForkJoin
import static groovyx.gpars.GParsPool.withPool
withPool() {
    println """Number of files: ${
        runForkJoin(new File("./src")) {file ->
            long count = 0
            file.eachFile {
                if (it.isDirectory()) {
                    println "Forking a child task for $it"
                    forkOffChild(it)           //fork a child task
                } else {
                    count++
                }
            }
            return count + (childrenResults.sum(0))
            //use results of children tasks to calculate and store own result
        }
    }"""
}
它可以工作并返回正确数量的文件,但不幸的是我不明白这一行:
return count + (childrenResults.sum(0))
究竟是如何工作count的childrenResult?
为什么将 a0作为参数传递给sum()?