public void RunAsyncTask(AsyncTask task) { if (task.CanRunOnThread) { lock (this.asyncTasks) { this.asyncTasks.AddLast(task.GetExecuter());//立即执行 } this.asyncWait.Set(); } else { StartCoroutine(task.GetExecuter());//利用协程等待IEnumerator } }
public void RunAsyncTask(AsyncTask task) { if (task.CanRunOnThread) { lock (this.threadTasks) { this.threadTasks.AddLast(task.GetExecuter()); } this.asyncWait.Set(); } else { lock (this.mainTasks) { this.mainTasks.AddLast(task.GetExecuter()); } } }