Exemplo n.º 1
0
        public void Enqueue(int queueNum, IEnumerator enumerator)
        {
            TaskMember task = m_pool.Request();

            task.enumerator = enumerator;
            if (!m_queueDict.TryGetValue(queueNum, out Queue <TaskMember> taskQueue))
            {
                taskQueue = new Queue <TaskMember>();
                m_queueDict.Add(queueNum, taskQueue);
            }
            taskQueue.Enqueue(task);
        }
Exemplo n.º 2
0
 protected void Update()
 {
     foreach (var item in m_queueDict.Values)
     {
         if (item.Count > 0)
         {
             TaskMember firstTask = item.Peek();
             if (!firstTask.enumerator.MoveNext())
             {
                 item.Dequeue();
                 m_pool.GiveBack(firstTask);
             }
         }
     }
 }