// Update will execute tasks off the task list
 public void Update()
 {
     if (_paused)
     {
         return;
     }
     lock (_asyncWorkQueue)
     {
         int workCount = _asyncWorkQueue.Count;
         for (var i = 0; i < workCount; i++)
         {
             WorkRequest work = _asyncWorkQueue.Dequeue();
             work.Invoke();
         }
     }
 }
Exemplo n.º 2
0
        // Exec will execute tasks off the task list
        private void Exec()
        {
            lock (m_AsyncWorkQueue)
            {
                m_CurrentFrameWork.AddRange(m_AsyncWorkQueue);
                m_AsyncWorkQueue.Clear();
            }

            // When you invoke work, remove it from the list to stop it being triggered again (case 1213602)
            while (m_CurrentFrameWork.Count > 0)
            {
                WorkRequest work = m_CurrentFrameWork[0];
                m_CurrentFrameWork.Remove(work);
                work.Invoke();
            }
        }