Пример #1
0
 private void OnFileEvent(object sender, FileEventArgs e)
 {
     RemoveInvalidClients();
     using (AutoLock.LockToRead(_clients.Lock, 5000))
     {
         foreach (Client client in _clients.Values)
         {
             ThreadPool.QueueUserWorkItem(NotifyThreadProc, NotifyThreadStateInfo.Create(client, e));
         }
     }
 }
Пример #2
0
        private void NotifyThreadProc(object state)
        {
            NotifyThreadStateInfo stateInfo = state as NotifyThreadStateInfo;

            if (stateInfo == null)
            {
                return;
            }

            try
            {
                stateInfo.Client.Callback.OnFileChangeEvent(stateInfo.Args);
            }
            catch (TimeoutException)
            {
                stateInfo.Client.Invalidate();
            }
        }