示例#1
0
    private void PerformRequest()
    {
        while (running)
        {
            Request request;
            bool    completed = requests.TryDequeue(out request);

            if (completed)
            {
                request.Perform();
            }

            completedRequests.Enqueue(request);

            Thread.Sleep(sleepMilliseconds);
        }
    }
示例#2
0
    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();
            }
        }
    }