public MultithreadedGame() : base() { _DrawThread = new WorkerThread(ThreadedDraw, 3); #if XBOX Thread.CurrentThread.SetProcessorAffinity(1); #endif }
protected void ThreadedDraw(WorkerThread thread) { try { RenderFrameToDraw(); base.EndDraw(); _DeviceLost |= CheckGraphicsDeviceLost(); } catch (DeviceLostException) { _DeviceLost = true; } finally { Interlocked.Decrement(ref _DrawDepth); } }
protected void ThreadedDraw(WorkerThread thread) { try { RenderFrameToDraw(); _SyncEndDraw(); _DeviceLost |= IsDeviceLost; } catch (DeviceLostException) { _DeviceLost = true; } catch (ObjectDisposedException) { if (Device.IsDisposed) _Running = false; else throw; } finally { Interlocked.Decrement(ref _DrawDepth); } }
private void CoreInitialize() { _DrawThread = new WorkerThread(ThreadedDraw); Device.DeviceResetting += OnDeviceResetting; Device.DeviceReset += OnDeviceReset; }
public void Dispose() { _Running = false; try { if (_DrawThread != null) { _DrawThread.Dispose(); _DrawThread = null; } FlushPendingDisposes(); } catch (ObjectDisposedException) { } catch (DeviceLostException) { } catch (DeviceNotResetException) { } }