better debug logging + fix tracking crash
This commit is contained in:
@@ -648,8 +648,12 @@ public class AsyncNodeManager {
|
|||||||
public void addTopLevel(long section) {//Only called from render thread
|
public void addTopLevel(long section) {//Only called from render thread
|
||||||
if (!this.running) throw new IllegalStateException("Not running");
|
if (!this.running) throw new IllegalStateException("Not running");
|
||||||
long stamp = this.tlnLock.writeLock();
|
long stamp = this.tlnLock.writeLock();
|
||||||
int state = this.tlnAdd.add(section)?1:0;
|
int state = 0;
|
||||||
state -= this.tlnRem.remove(section)?1:0;
|
if (!this.tlnRem.remove(section)) {
|
||||||
|
state += this.tlnAdd.add(section)?1:0;
|
||||||
|
} else {
|
||||||
|
state -= 1;
|
||||||
|
}
|
||||||
if (state != 0) {
|
if (state != 0) {
|
||||||
if (this.workCounter.getAndAdd(state) == 0) {
|
if (this.workCounter.getAndAdd(state) == 0) {
|
||||||
LockSupport.unpark(this.thread);
|
LockSupport.unpark(this.thread);
|
||||||
@@ -661,8 +665,12 @@ public class AsyncNodeManager {
|
|||||||
public void removeTopLevel(long section) {//Only called from render thread
|
public void removeTopLevel(long section) {//Only called from render thread
|
||||||
if (!this.running) throw new IllegalStateException("Not running");
|
if (!this.running) throw new IllegalStateException("Not running");
|
||||||
long stamp = this.tlnLock.writeLock();
|
long stamp = this.tlnLock.writeLock();
|
||||||
int state = this.tlnRem.add(section)?1:0;
|
int state = 0;
|
||||||
state -= this.tlnAdd.remove(section)?1:0;
|
if (!this.tlnAdd.remove(section)) {
|
||||||
|
state += this.tlnRem.add(section)?1:0;
|
||||||
|
} else {
|
||||||
|
state -= 1;
|
||||||
|
}
|
||||||
if (state != 0) {
|
if (state != 0) {
|
||||||
if (this.workCounter.getAndAdd(state) == 0) {
|
if (this.workCounter.getAndAdd(state) == 0) {
|
||||||
LockSupport.unpark(this.thread);
|
LockSupport.unpark(this.thread);
|
||||||
|
|||||||
@@ -162,7 +162,7 @@ public class NodeManager {
|
|||||||
|
|
||||||
public void removeTopLevelNode(long pos) {
|
public void removeTopLevelNode(long pos) {
|
||||||
if (!this.topLevelNodes.remove(pos)) {
|
if (!this.topLevelNodes.remove(pos)) {
|
||||||
throw new IllegalStateException("Position not in top level map");
|
throw new IllegalStateException("Position not in top level map: " + WorldEngine.pprintPos(pos));
|
||||||
}
|
}
|
||||||
int nodeId = this.activeSectionMap.get(pos);
|
int nodeId = this.activeSectionMap.get(pos);
|
||||||
if (nodeId == -1) {
|
if (nodeId == -1) {
|
||||||
|
|||||||
Reference in New Issue
Block a user