use of io.xol.chunkstories.api.workers.TaskExecutor in project chunkstories by Hugobros3.
the class ConverterWorkers method dropAll.
public void dropAll() {
CompoundFence readyAll = new CompoundFence();
CompoundFence doneAll = new CompoundFence();
SimpleFence atSignal = new SimpleFence();
for (int i = 0; i < workers.length; i++) {
SimpleFence ready = new SimpleFence();
readyAll.add(ready);
SimpleFence done = new SimpleFence();
doneAll.add(done);
scheduleTask(new Task() {
@Override
protected boolean task(TaskExecutor taskExecutor) {
ready.signal();
atSignal.traverse();
ConverterWorkerThread cwt = (ConverterWorkerThread) taskExecutor;
for (ChunkHolder holder : cwt.registeredCS_Holders) {
holder.unregisterUser(cwt);
cwt.chunksAquired--;
}
for (Heightmap summary : cwt.registeredCS_Summaries) summary.unregisterUser(cwt);
cwt.registeredCS_Summaries.clear();
cwt.registeredCS_Holders.clear();
done.signal();
return true;
}
});
}
readyAll.traverse();
atSignal.signal();
doneAll.traverse();
}
Aggregations