we do want to synchronise across the chunk when loading sections

Dieser Commit ist enthalten in:
dordsor21 2021-01-01 17:19:14 +00:00
Ursprung 42346b429b
Commit 39b0da2b99
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: 1E53E88969FFCF0B

Datei anzeigen

@ -54,14 +54,13 @@ public abstract class CharBlocks implements IBlocks {
}; };
public final char[][] blocks; public final char[][] blocks;
public final Section[] sections; public final Section[] sections;
private final Object[] loadLock = new Object[16]; private final Object loadLock = new Object();
public CharBlocks() { public CharBlocks() {
blocks = new char[16][]; blocks = new char[16][];
sections = new Section[16]; sections = new Section[16];
for (int i = 0; i < 16; i++) { for (int i = 0; i < 16; i++) {
sections[i] = EMPTY; sections[i] = EMPTY;
loadLock[i] = new Object();
} }
} }
@ -122,7 +121,7 @@ public abstract class CharBlocks implements IBlocks {
if (section.isFull()) { if (section.isFull()) {
return section.get(this, layer); return section.get(this, layer);
} }
synchronized (loadLock[layer]) { synchronized (loadLock) {
return sections[layer].get(this, layer); return sections[layer].get(this, layer);
} }
} }