mirror of
https://gitlab.bixilon.de/bixilon/minosoft.git
synced 2025-09-18 11:54:59 -04:00
entity renderer: fix freeze on low thread systems
This commit is contained in:
parent
4edfdd9235
commit
24704e4b99
@ -15,7 +15,7 @@ package de.bixilon.minosoft.gui.rendering.entity
|
|||||||
|
|
||||||
import de.bixilon.kutil.collections.CollectionUtil.lockMapOf
|
import de.bixilon.kutil.collections.CollectionUtil.lockMapOf
|
||||||
import de.bixilon.kutil.collections.CollectionUtil.synchronizedListOf
|
import de.bixilon.kutil.collections.CollectionUtil.synchronizedListOf
|
||||||
import de.bixilon.kutil.collections.iterator.async.QueuedIterator
|
import de.bixilon.kutil.collections.iterator.async.ConcurrentIterator
|
||||||
import de.bixilon.kutil.collections.map.LockMap
|
import de.bixilon.kutil.collections.map.LockMap
|
||||||
import de.bixilon.kutil.concurrent.pool.DefaultThreadPool
|
import de.bixilon.kutil.concurrent.pool.DefaultThreadPool
|
||||||
import de.bixilon.kutil.concurrent.pool.ThreadPool
|
import de.bixilon.kutil.concurrent.pool.ThreadPool
|
||||||
@ -53,7 +53,6 @@ class EntityRenderer(
|
|||||||
private val models: LockMap<Entity, EntityModel<*>> = lockMapOf()
|
private val models: LockMap<Entity, EntityModel<*>> = lockMapOf()
|
||||||
private lateinit var localModel: LocalPlayerModel
|
private lateinit var localModel: LocalPlayerModel
|
||||||
private var toUnload: MutableList<EntityModel<*>> = synchronizedListOf()
|
private var toUnload: MutableList<EntityModel<*>> = synchronizedListOf()
|
||||||
private val iterator = QueuedIterator(models.unsafe.values.spliterator(), priority = ThreadPool.HIGHER, queueSize = 1000)
|
|
||||||
|
|
||||||
var hitboxes = profile.hitbox.enabled
|
var hitboxes = profile.hitbox.enabled
|
||||||
|
|
||||||
@ -153,8 +152,7 @@ class EntityRenderer(
|
|||||||
|
|
||||||
private fun runAsync(executor: ((EntityModel<*>) -> Unit)) {
|
private fun runAsync(executor: ((EntityModel<*>) -> Unit)) {
|
||||||
models.lock.acquire()
|
models.lock.acquire()
|
||||||
iterator.reuse(models.unsafe.values.spliterator())
|
ConcurrentIterator(models.unsafe.values.spliterator(), priority = ThreadPool.HIGHER).iterate(executor)
|
||||||
iterator.iterate(executor)
|
|
||||||
models.lock.release()
|
models.lock.release()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user