Exemplo n.º 1
0
 public MessageQueueItem Add(string key, Action action)
 {
     lock (MessageQueueSyncLock)
     {
         var mqItem = new MessageQueueItem(key, action);
         MessageQueueDictionary.TryAdd(key, mqItem);
         return(mqItem);
     }
 }
Exemplo n.º 2
0
 public bool Remove(string key, out MessageQueueItem value)
 {
     lock (MessageQueueSyncLock)
     {
         if (MessageQueueDictionary.ContainsKey(key))
         {
             return(MessageQueueDictionary.TryRemove(key, out value));
         }
         else
         {
             value = null;
             return(true);
         }
     }
 }