mirror of
https://gitlab.bixilon.de/bixilon/minosoft.git
synced 2025-09-16 19:05:02 -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 size = data["size"]?.toLong() ?: -1
|
||||||
val hash = data["hash"].toString()
|
val hash = data["hash"].toString()
|
||||||
if (tasks.count > DefaultThreadPool.threadCount - 1) {
|
synchronized(tasks.lock) {
|
||||||
tasks.waitForChange()
|
if (tasks.count > DefaultThreadPool.threadCount - 1) {
|
||||||
|
tasks.waitForChange()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
tasks.inc()
|
tasks.inc()
|
||||||
DefaultThreadPool += ThreadPoolRunnable(priority = ThreadPool.LOW) {
|
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) {
|
class CountUpAndDownLatch @JvmOverloads constructor(count: Int, var parent: CountUpAndDownLatch? = null) {
|
||||||
private val changeCallbacks: MutableSet<() -> Unit> = mutableSetOf()
|
private val changeCallbacks: MutableSet<() -> Unit> = mutableSetOf()
|
||||||
private val lock = Object()
|
val lock = Object()
|
||||||
private val children: MutableSet<CountUpAndDownLatch> = synchronizedSetOf()
|
private val children: MutableSet<CountUpAndDownLatch> = synchronizedSetOf()
|
||||||
private var rawCount = 0
|
private var rawCount = 0
|
||||||
set(value) {
|
set(value) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user