mirror of
https://github.com/HighCapable/YukiHookAPI.git
synced 2025-09-04 17:55:24 +08:00
Modify remove parallelForEach function because it is no need anymore in UtilsFactory
This commit is contained in:
@@ -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]
|
||||
|
Reference in New Issue
Block a user