private void PerformRequest() { while (running) { Request request; bool completed = requests.TryDequeue(out request); if (completed) { request.Perform(); } completedRequests.Enqueue(request); Thread.Sleep(sleepMilliseconds); } }
public void Update() { while (newRequests.Count > 0) { Request request = newRequests.Dequeue(); request.PrePerformance(); requests.Enqueue(request); } while (completedRequests.Count() > 0) { Request request = null; bool complete = completedRequests.TryDequeue(out request); if (request != null) { request.PostPerformance(); } } }