示例#1
0
        public static void RunOnMainThreadBlockingNullable(this IAsyncContext context, Action action)
        {
            if (context == null)
            {
                using var semaphore = new SemaphoreSlim(0, 1);
                AltAsync.RunOnMainThreadBlocking(action, semaphore);
                return;
            }

            context.RunOnMainThreadBlocking(action);
        }
 public void RunOnMainThreadBlocking(Action action)
 {
     if (throwOnExistsCheck)
     {
         AltAsync.RunOnMainThreadBlockingThrows(action, semaphoreSlim);
     }
     else
     {
         AltAsync.RunOnMainThreadBlocking(action, semaphoreSlim);
     }
 }