public static T DispatchToMainThreadReturn <T>(CallBackReturn <T> dispatchCall, bool safeMode = true) { bool flag = MainThreadWatchdog.CheckIfMainThread(); T result; if (flag) { bool flag2 = dispatchCall != null; if (flag2) { result = dispatchCall(); } else { result = default(T); } } else { ThreadDispatchAction <T> threadDispatchAction = new ThreadDispatchAction <T>(); MainThreadDispatcher.dispatchActions.Enqueue(threadDispatchAction); threadDispatchAction.Init(dispatchCall, safeMode); result = threadDispatchAction.dispatchExecutionResult2; } return(result); }
public static T DispatchToMainThreadReturn <T>(CallBackReturn <T> dispatchCall, bool safeMode = true) { if (MainThreadWatchdog.CheckIfMainThread()) { if (dispatchCall != null) { return(dispatchCall()); } } else { ThreadDispatchAction <T> t = new ThreadDispatchAction <T>(); dispatchActions.Enqueue(t); t.Init(dispatchCall, safeMode); return(t.dispatchExecutionResult2); } return(default(T)); }
public void Init(CallBackReturn <T> dispatchCall, bool safeMode) { this.safeMode = safeMode; this.dispatchCallReturn2 = dispatchCall; this.ValidateExecutionOnInit(true); }
public static T DispatchToMainThreadReturn <T>(CallBackReturn <T> dispatchCall, bool safeMode = true) { return(MainThreadDispatcher.DispatchToMainThreadReturn <T>(dispatchCall, safeMode)); }
public static object DispatchToMainThreadReturn(CallBackReturn dispatchCall, bool safeMode = true) { return(MainThreadDispatcher.DispatchToMainThreadReturn(dispatchCall, safeMode)); }