public virtual void OnDestroy() { while (!Monitor.TryEnter(this.m_queueLock, SimulationManager.SYNCHRONIZE_TIMEOUT)) { } try { this.m_terminated = true; Monitor.PulseAll(this.m_queueLock); } finally { Monitor.Exit(this.m_queueLock); } }