mirror of https://github.com/Cysharp/UniTask
Add UniTask.Post
parent
d6a0563319
commit
5ed943bca2
|
@ -173,8 +173,15 @@ namespace Cysharp.Threading.Tasks.Internal
|
||||||
var action = actionList[i];
|
var action = actionList[i];
|
||||||
actionList[i] = null;
|
actionList[i] = null;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
action();
|
action();
|
||||||
}
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
UnityEngine.Debug.LogException(ex);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
bool lockTaken = false;
|
bool lockTaken = false;
|
||||||
|
|
|
@ -44,6 +44,14 @@ namespace Cysharp.Threading.Tasks
|
||||||
return new ReturnToMainThread(timing);
|
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
|
#endif
|
||||||
|
|
||||||
public static SwitchToThreadPoolAwaitable SwitchToThreadPool()
|
public static SwitchToThreadPoolAwaitable SwitchToThreadPool()
|
||||||
|
|
Loading…
Reference in New Issue