mirror of
https://gitlab.bixilon.de/bixilon/minosoft.git
synced 2025-09-16 10:55:01 -04:00
assets verify: fix infinite waiting
This commit is contained in:
parent
d12a69974a
commit
ba498b35b9
@ -113,8 +113,10 @@ class IndexAssetsManager(
|
||||
|
||||
val size = data["size"]?.toLong() ?: -1
|
||||
val hash = data["hash"].toString()
|
||||
if (tasks.count > DefaultThreadPool.threadCount - 1) {
|
||||
tasks.waitForChange()
|
||||
synchronized(tasks.lock) {
|
||||
if (tasks.count > DefaultThreadPool.threadCount - 1) {
|
||||
tasks.waitForChange()
|
||||
}
|
||||
}
|
||||
tasks.inc()
|
||||
DefaultThreadPool += ThreadPoolRunnable(priority = ThreadPool.LOW) {
|
||||
|
@ -18,7 +18,7 @@ import de.bixilon.minosoft.util.KUtil.toSynchronizedList
|
||||
|
||||
class CountUpAndDownLatch @JvmOverloads constructor(count: Int, var parent: CountUpAndDownLatch? = null) {
|
||||
private val changeCallbacks: MutableSet<() -> Unit> = mutableSetOf()
|
||||
private val lock = Object()
|
||||
val lock = Object()
|
||||
private val children: MutableSet<CountUpAndDownLatch> = synchronizedSetOf()
|
||||
private var rawCount = 0
|
||||
set(value) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user