Fix creation deadlock (#1154)

This commit is contained in:
Julian Krings 2025-01-25 14:54:21 +01:00 committed by GitHub
parent 474e033c2b
commit ce0092c52a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 12 additions and 7 deletions

View File

@ -113,7 +113,6 @@ public class IrisJigsawStructure extends IrisRegistrant {
}
}
}
pieces.addIfMissing(p);
}
public int getMaxDimension() {
@ -140,6 +139,14 @@ public class IrisJigsawStructure extends IrisRegistrant {
loadPiece(i, pools, pieces);
}
if (pieces.isEmpty()) {
int max = 0;
for (String i : getPieces()) {
max = Math.max(max, getLoader().getJigsawPieceLoader().load(i).getMax2dDimension());
}
return max;
}
int avg = 0;
for (String i : pieces) {

View File

@ -26,7 +26,6 @@ import com.volmit.iris.util.matter.IrisMatter;
import com.volmit.iris.util.matter.Matter;
import com.volmit.iris.util.matter.MatterSlice;
import lombok.Getter;
import lombok.Synchronized;
import java.io.ByteArrayOutputStream;
import java.io.DataOutputStream;
@ -117,17 +116,16 @@ public class MantleChunk {
ref.decrementAndGet();
}
@Synchronized
public void flag(MantleFlag flag, boolean f) {
flags.set(flag.ordinal(), f ? 1 : 0);
}
@Synchronized
public void raiseFlag(MantleFlag flag, Runnable r) {
if (!isFlagged(flag)) {
flag(flag, true);
r.run();
synchronized (this) {
if (!isFlagged(flag)) flag(flag, true);
else return;
}
r.run();
}
public boolean isFlagged(MantleFlag flag) {