Ejemplo n.º 1
0
        public void RunProcess(Action process, PriorityClass priorityClass, string processName, bool runInThread)
        {
            process = TaskInProgress.Start(this, process, $"RunProcess[{processName}]");
            LogTileMessage($"Starting Process '{processName}'...");

            if (runInThread)
            {
                process();
            }
            else
            {
                PriorityScheduler.Schedule(process, priorityClass, Centroid);
            }
        }
Ejemplo n.º 2
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="phase"></param>
 /// <param name="action"></param>
 /// <returns>True if the action was executed immediately</returns>
 public bool InvokeWhenCompleted(GenerationStage phase, Action <bool> action, string reason)
 {
     action = TaskInProgress.Start(this, action, $"InvokeWhenCompleted[{phase}]:{reason}");
     if (CompletedPhase >= phase && Thread.CurrentThread == VoxelGame.GameThread)
     {
         action(true);
         return(true);
     }
     else
     {
         _pendingActions[(int)phase].Enqueue(() => action(false));
         return(false);
     }
 }