Exemplo n.º 1
0
        private void ApplyProc()
        {
            var wh = new WaitHandle[] { _evExit, _evGotNotification };

            while (true)
            {
                IRepositoryChangedNotification notification = null;
                lock (_pendingNotifications)
                {
                    if (_pendingNotifications.Count != 0)
                    {
                        notification = _pendingNotifications.Dequeue();
                    }
                }
                if (notification == null)
                {
                    if (WaitHandle.WaitAny(wh) == 0)
                    {
                        return;
                    }
                    continue;
                }
                try
                {
                    notification.Apply(_repository);
                }
                catch
                {
                }
            }
        }