private void Run() { while (true) { IEvent task = null; lock (m_Locker) { if (m_Tasks.Count > 0) { task = m_Tasks.Dequeue(); if (task == null) { return; } } } if (task != null) { task.DoTask(this); } else { m_WaitHandle.WaitOne(); } } }