Пример #1
0
 public void OnRaw(int bufId, RawDataHeader.RawDataHandler handler)
 {
     if (!_rawDataHandlers.TryGetValue(bufId, out var list))
     {
         _rawDataHandlers.TryAdd(bufId, list = new LinkedList <RawDataHeader.RawDataHandler>());
     }
     lock (list)
     {
         list.AddLast(handler);
     }
 }
Пример #2
0
        public bool OffRaw(int bufId, RawDataHeader.RawDataHandler handler)
        {
            if (!_rawDataHandlers.TryGetValue(bufId, out var list))
            {
                return(false);
            }
            bool ret;

            lock (list)
            {
                ret = list.Remove(handler);
            }

            return(ret);
        }