public void Run() { while (run) { Exception job = (pendingJobs.Count > 0) ? pendingJobs.Dequeue() : defaultJob; if (job!= null) { ////what to do with current Exception } Thread.Sleep(20); //I know this is bad... } pendingJobs.Clear(); } }
public void Load() { JobQueue.Run(() => BiomeTerrainChunkGenerator.GenerateChunkData(startPoint, coord, worldSettings), this.OnHeightMapReceived); }