Add UniTask.Post
parent
d6a0563319
commit
5ed943bca2
|
@ -9,7 +9,7 @@ namespace Cysharp.Threading.Tasks.Internal
|
|||
{
|
||||
const int MaxArrayLength = 0X7FEFFFFF;
|
||||
const int InitialSize = 16;
|
||||
|
||||
|
||||
readonly PlayerLoopTiming timing;
|
||||
|
||||
SpinLock gate = new SpinLock();
|
||||
|
@ -173,7 +173,14 @@ namespace Cysharp.Threading.Tasks.Internal
|
|||
var action = actionList[i];
|
||||
actionList[i] = null;
|
||||
|
||||
action();
|
||||
try
|
||||
{
|
||||
action();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
UnityEngine.Debug.LogException(ex);
|
||||
}
|
||||
}
|
||||
|
||||
{
|
||||
|
|
|
@ -44,6 +44,14 @@ namespace Cysharp.Threading.Tasks
|
|||
return new ReturnToMainThread(timing);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Queue the action to PlayerLoop.
|
||||
/// </summary>
|
||||
public static void Post(Action action, PlayerLoopTiming timing = PlayerLoopTiming.Update)
|
||||
{
|
||||
PlayerLoopHelper.AddContinuation(timing, action);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
public static SwitchToThreadPoolAwaitable SwitchToThreadPool()
|
||||
|
|
Loading…
Reference in New Issue