Fixed seemingly random server crashes caused by ArrayIndexOutOfBoundsException on unsafe type during threaded operations by synchronizing add/remove logic for PulseRunner.TASKS
This commit is contained in:
@@ -10,10 +10,13 @@ import java.util.*
|
||||
|
||||
class PulseRunner {
|
||||
val TASKS = ArrayList<Pulse>()
|
||||
|
||||
fun submit(pulse: Pulse){
|
||||
synchronized(this.TASKS) {
|
||||
TASKS.add(pulse)
|
||||
}
|
||||
}
|
||||
}
|
||||
/*
|
||||
class PulseeRunner {
|
||||
val MAXIMUM_NUM_THREADS = 4
|
||||
|
||||
@@ -106,8 +106,10 @@ class MajorUpdateWorker {
|
||||
|
||||
//remove all null or finished pulses from the list
|
||||
rmlist.forEach {
|
||||
synchronized(GameWorld.Pulser.TASKS) {
|
||||
GameWorld.Pulser.TASKS.remove(it)
|
||||
}
|
||||
}
|
||||
|
||||
rmlist.clear()
|
||||
//perform our update sequence where we write masks, etc
|
||||
|
||||
Reference in New Issue
Block a user