misc fixes
This commit is contained in:
@@ -46,15 +46,19 @@ public class ServiceThreadPool {
|
|||||||
//Set worker affinity if possible
|
//Set worker affinity if possible
|
||||||
CpuLayout.setThreadAffinity(CpuLayout.CORES[2 + (threadId % (CpuLayout.CORES.length - 2))]);
|
CpuLayout.setThreadAffinity(CpuLayout.CORES[2 + (threadId % (CpuLayout.CORES.length - 2))]);
|
||||||
}
|
}
|
||||||
|
if (threadId != 0) {
|
||||||
ThreadUtils.SetSelfThreadPriorityWin32(ThreadUtils.WIN32_THREAD_PRIORITY_LOWEST);
|
ThreadUtils.SetSelfThreadPriorityWin32(ThreadUtils.WIN32_THREAD_PRIORITY_LOWEST);
|
||||||
//ThreadUtils.SetSelfThreadPriorityWin32(ThreadUtils.WIN32_THREAD_MODE_BACKGROUND_BEGIN);
|
//ThreadUtils.SetSelfThreadPriorityWin32(ThreadUtils.WIN32_THREAD_MODE_BACKGROUND_BEGIN);
|
||||||
|
}
|
||||||
this.worker(threadId);
|
this.worker(threadId);
|
||||||
});
|
});
|
||||||
worker.setDaemon(false);
|
worker.setDaemon(false);
|
||||||
worker.setName("Service worker #" + i);
|
worker.setName("Service worker #" + i);
|
||||||
worker.setPriority(priority);
|
if (i == 0) {//Give the first thread normal priority, this helps if the system is under huge load for voxy to get some work done
|
||||||
|
worker.setPriority(Thread.NORM_PRIORITY);
|
||||||
|
} else {
|
||||||
|
worker.setPriority(priority);
|
||||||
|
}
|
||||||
worker.start();
|
worker.start();
|
||||||
worker.setUncaughtExceptionHandler(this::handleUncaughtException);
|
worker.setUncaughtExceptionHandler(this::handleUncaughtException);
|
||||||
this.workers[i] = worker;
|
this.workers[i] = worker;
|
||||||
|
|||||||
@@ -86,6 +86,9 @@ public class VoxelIngestService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void enqueueIngest(WorldEngine engine, WorldChunk chunk) {
|
public void enqueueIngest(WorldEngine engine, WorldChunk chunk) {
|
||||||
|
if (!this.threads.isAlive()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (!engine.isLive()) {
|
if (!engine.isLive()) {
|
||||||
throw new IllegalStateException("Tried inserting chunk into WorldEngine that was not alive");
|
throw new IllegalStateException("Tried inserting chunk into WorldEngine that was not alive");
|
||||||
}
|
}
|
||||||
@@ -117,7 +120,12 @@ public class VoxelIngestService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
this.ingestQueue.add(new IngestSection(chunk.getPos().x, i, chunk.getPos().z, engine, section, bl, sl));
|
this.ingestQueue.add(new IngestSection(chunk.getPos().x, i, chunk.getPos().z, engine, section, bl, sl));
|
||||||
this.threads.execute();
|
try {
|
||||||
|
this.threads.execute();
|
||||||
|
} catch (Exception e) {
|
||||||
|
Logger.error("Executing had an error: assume shutting down, aborting",e);
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user