Mirror von
https://github.com/IntellectualSites/FastAsyncWorldEdit.git
synchronisiert 2024-11-02 17:40:09 +01:00
lock when editing the chunks cache in SingletThreadQueueExtent
- Long2ObjectLinkedOpenHashMap is not thread-safe and should not be used from multiple threads at once - Fixes #851
Dieser Commit ist enthalten in:
Ursprung
3034419918
Commit
fa69c79160
@ -114,7 +114,9 @@ public class SingleThreadQueueExtent extends ExtentBatchProcessorHolder implemen
|
|||||||
for (IChunk chunk : this.chunks.values()) {
|
for (IChunk chunk : this.chunks.values()) {
|
||||||
chunk.recycle();
|
chunk.recycle();
|
||||||
}
|
}
|
||||||
|
getChunkLock.lock();
|
||||||
this.chunks.clear();
|
this.chunks.clear();
|
||||||
|
getChunkLock.unlock();
|
||||||
}
|
}
|
||||||
this.enabledQueue = true;
|
this.enabledQueue = true;
|
||||||
this.lastChunk = null;
|
this.lastChunk = null;
|
||||||
@ -163,7 +165,9 @@ public class SingleThreadQueueExtent extends ExtentBatchProcessorHolder implemen
|
|||||||
lastChunk = null;
|
lastChunk = null;
|
||||||
}
|
}
|
||||||
final long index = MathMan.pairInt(chunk.getX(), chunk.getZ());
|
final long index = MathMan.pairInt(chunk.getX(), chunk.getZ());
|
||||||
|
getChunkLock.lock();
|
||||||
chunks.remove(index, chunk);
|
chunks.remove(index, chunk);
|
||||||
|
getChunkLock.unlock();
|
||||||
V future = submitUnchecked(chunk);
|
V future = submitUnchecked(chunk);
|
||||||
submissions.add(future);
|
submissions.add(future);
|
||||||
return future;
|
return future;
|
||||||
@ -374,7 +378,9 @@ public class SingleThreadQueueExtent extends ExtentBatchProcessorHolder implemen
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
getChunkLock.lock();
|
||||||
chunks.clear();
|
chunks.clear();
|
||||||
|
getChunkLock.unlock();
|
||||||
}
|
}
|
||||||
pollSubmissions(0, true);
|
pollSubmissions(0, true);
|
||||||
}
|
}
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren