internal void AddTask(TaskBase task) { lock (taskList) { taskList.Add(task); if (TaskSortingSystem == UnityThreading.TaskSortingSystem.ReorderWhenAdded || TaskSortingSystem == UnityThreading.TaskSortingSystem.ReorderWhenExecuted) { ReorderTasks(); } } dataEvent.Set(); }
/// <summary> /// Dispatches the given task to the target Dispatcher (default: the main Dispatcher). /// This method will wait for the task completion or the timeout. /// </summary> /// <param name="taskBase">The task to process at the dispatchers thread.</param> /// <param name="timeOutSeconds">Time in seconds after the waiting process will stop.</param> public void DispatchAndWait(TaskBase taskBase, float timeOutSeconds) { var task = this.Dispatch(taskBase); task.WaitForSeconds(timeOutSeconds); }
/// <summary> /// Dispatches the given task to the target Dispatcher (default: the main Dispatcher). /// This method will wait for the task completion. /// </summary> /// <param name="taskBase">The task to process at the dispatchers thread.</param> public void DispatchAndWait(TaskBase taskBase) { var task = this.Dispatch(taskBase); task.Wait(); }
/// <summary> /// Dispatches the given task to the target Dispatcher (default: the main Dispatcher). /// </summary> /// <param name="taskBase">The task to process at the dispatchers thread.</param> /// <returns>The new task.</returns> public TaskBase Dispatch(TaskBase taskBase) { return(targetDispatcher.Dispatch(taskBase)); }