Ejemplo n.º 1
0
 public void TerminateAll()
 {
     m_continueIteration = -1;
     for (int i = m_activeTasks.Count - 1; i >= 0; --i)
     {
         TaskBase task = m_activeTasks[i];
         task.TaskInfo.State = TaskState.Terminated;
         RaiseTaskStateChanged(task.TaskInfo);
     }
 }
Ejemplo n.º 2
0
 public void Destroy()
 {
     TerminateAll();
     for (int i = m_activeTasks.Count - 1; i >= 0; --i)
     {
         TaskBase task = m_activeTasks[i];
         Release(task);
     }
     m_activeTasks.Clear();
     m_idToActiveTask.Clear();
 }
Ejemplo n.º 3
0
        private void Release(TaskBase task)
        {
            if (!task.IsAcquired)
            {
                throw new InvalidOperationException("!IsAcqired");
            }

            task.ChildTaskActivated -= OnChildTaskActivated;
            task.IsAcquired          = false;
            TaskInfo taskInfo = task.TaskInfo;

            if (taskInfo.State != TaskState.Active)
            {
                Memory.DestroyScope(taskInfo.TaskId);
            }

            if (taskInfo.TaskType == TaskType.Command)
            {
                if (taskInfo.Expression != null)
                {
                    m_cmdExpressionTaskPool.Release(task);
                }
                else
                {
                    if (taskInfo.Cmd.Code == CmdCode.Move)
                    {
                        m_cmdMoveTaskPool.Release(task);
                    }
                    else
                    {
                        m_cmdGenericTaskPool.Release(task);
                    }
                }
            }
            else
            {
                m_taskPools[taskInfo.TaskType].Release(task);
            }
        }
Ejemplo n.º 4
0
 private void OnChildTaskActivated(TaskBase parent, TaskInfo taskInfo)
 {
     HandleTaskActivation(parent, taskInfo);
 }
Ejemplo n.º 5
0
 void ITaskPool.Release(TaskBase task)
 {
     base.Release((T)task);
 }