internal void Wait() { StopSignal.WaitOne(); while (Running) { StopSignal.WaitOne(); } }
private void Run() { try { bool receivedStopSignal = false; ThreadSetup(); //Initial wait before starting. Thread.Sleep(30); while (!receivedStopSignal) { ThreadUpdate(); // See if the main thread signaled us to stop if (StopSignal.WaitOne(0)) { receivedStopSignal = true; } if (!receivedStopSignal) { System.Threading.Thread.Sleep(1); } } ThreadTeardown(); } catch (Exception e) { UnityEngine.Debug.LogError(string.Format("PSMoveWorker: WorkerThread crashed: {0}", e.Message)); UnityEngine.Debug.LogException(e); } finally { ExitedSignal.Set(); } }