Ejemplo n.º 1
0
        private void _bw_DoWork(object sender, DoWorkEventArgs e)
        {
            if (InputAnalyzerManager.CurrentGame == null)
            {
                return;
            }
            _analyzer.OnCreate(_parameters, _proxyGame);
            IProcessRequest p;

            while (!_bw.CancellationPending)
            {
                if (_requestQueue.TryDequeue(out p))
                {
                    p.Process(_proxyGame);
                }
                else if (_requestQueue.IsEmpty)
                {
                    lock (_lockObject)
                    {
                        Monitor.Wait(_lockObject);
                    }
                }
            }
            _analyzer.OnDestroy();
        }