diff --git a/src/net/torvald/terrarum/concurrent/ThreadParallel.kt b/src/net/torvald/terrarum/concurrent/ThreadParallel.kt index 3166b0ce4..31fa1b439 100644 --- a/src/net/torvald/terrarum/concurrent/ThreadParallel.kt +++ b/src/net/torvald/terrarum/concurrent/ThreadParallel.kt @@ -25,6 +25,14 @@ object ThreadParallel { pool.forEach { it?.start() } } + /** + * Start all thread in the pool and wait for them to all die. If the thread in the pool is NULL, it will simply ignored. + */ + fun startAllWaitForDie() { + pool.forEach { it?.start() } + pool.forEach { it?.join() } + } + /** * Primitive locking */