Modify remove parallelForEach function because it is no need anymore in UtilsFactory

This commit is contained in:
2022-09-14 22:58:01 +08:00
parent 38efe2127b
commit f48b5b71a7

View File

@@ -29,7 +29,6 @@ package com.highcapable.yukihookapi.hook.utils
import java.util.concurrent.ExecutorService
import java.util.concurrent.Executors
import java.util.concurrent.TimeUnit
/**
* 创建当前线程池服务
@@ -60,22 +59,6 @@ internal inline fun <T> T.await(delayMs: Long = 1, crossinline block: (T) -> Uni
return this
}
/**
* 进行一次并行计算的 ForEach 操作
* @param action 回调内容方法体
*/
internal inline fun <T> Iterable<T>.parallelForEach(crossinline action: (T) -> Unit) {
currentThreadPool.apply {
val iterator = iterator()
while (iterator.hasNext()) {
val item = iterator.next()
execute { runCatching { action(item) } }
}
shutdown()
awaitTermination(Long.MAX_VALUE, TimeUnit.NANOSECONDS)
}
}
/**
* 获取数组内容依次列出的字符串表示
* @return [String]