Ejemplo n.º 1
0
 internal void Wait()
 {
     StopSignal.WaitOne();
     while (Running)
     {
         StopSignal.WaitOne();
     }
 }
Ejemplo n.º 2
0
    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();
        }
    }