public static void StopRender() { if (threadRender != null) { lock (LockRender) isStopFlag = QueueStop.Queue; while (true) { lock (LockRender) if (isStopFlag == QueueStop.Allow) break; Thread.Sleep(2); } } }
public static void StartRender() { if (threadRender == null) threadRender = new Thread(DrawLoop) { Name = "Graphic Render" }; lock (LockRender) isStopFlag = QueueStop.None; if (threadRender.ThreadState != ThreadState.Running) threadRender.Start(); }