您最多选择25个主题
主题必须以中文或者字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符
26 行
709 B
26 行
709 B
using System;
|
|
using System.Collections.Generic;
|
|
using Unity.UIWidgets.foundation;
|
|
using UnityEngine;
|
|
|
|
namespace Unity.UIWidgets.async {
|
|
public class MicrotaskQueue {
|
|
readonly Queue<Action> _queue = new Queue<Action>();
|
|
|
|
public void scheduleMicrotask(Action action) {
|
|
this._queue.Enqueue(action);
|
|
}
|
|
|
|
public void flushMicrotasks() {
|
|
while (this._queue.isNotEmpty()) {
|
|
var action = this._queue.Dequeue();
|
|
try {
|
|
action();
|
|
}
|
|
catch (Exception ex) {
|
|
Debug.LogError("Error to execute microtask: " + ex);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|