Пример #1
0
 public void Remove(UUID itemID, int handle)
 {
     /* standard foreach is implemented in RwLockedDictionary to make a copy first */
     foreach (KeyValuePair <int, ThreadedClasses.RwLockedList <ListenerInfo> > lis
              in m_listeners)
     {
         /* standard foreach is implemented in RwLockedDictionary to make a copy first */
         foreach (ListenerInfo li in lis.Value)
         {
             if (li.GetItemID().Equals(itemID) &&
                 li.GetHandle().Equals(handle))
             {
                 lis.Value.Remove(li);
                 Interlocked.Decrement(ref m_curlisteners);
                 m_listeners.RemoveIf(lis.Key, delegate(ThreadedClasses.RwLockedList <ListenerInfo> list) { return(list.Count == 0); });
                 // there should be only one, so we bail out early
                 return;
             }
         }
     }
 }