/// <summary> /// Adds a request enumerator to the queue. /// </summary> public static void Add(RequestEnumerator action) { lock (s_Requests) { s_Requests.Enqueue(action); } }
/// <summary> /// If there are queued requests, it will dequeue and fire them. If /// the request is not finished, it will be added back to the queue. /// </summary> public static void Execute() { if (s_Requests.Count > 0) { RequestEnumerator action = null; lock (s_Requests) { action = s_Requests.Dequeue(); } // Re-queue the action if it is not complete if (action.status.MoveNext()) { Add(action); } } }