예제 #1
0
 private void ClearAndFailChannelQueuedMessages(ErrorInfo error)
 {
     lock (_lockQueue)
     {
         foreach (var messageAndCallback in QueuedMessages)
         {
             messageAndCallback.SafeExecute(false, error);
         }
         QueuedMessages.Clear();
     }
 }
예제 #2
0
        private int SendQueuedMessages()
        {
            List <MessageAndCallback> list;

            lock (_lockQueue)
            {
                if (QueuedMessages.Count <= 0)
                {
                    return(0);
                }

                // Swap the list.
                list = new List <MessageAndCallback>(QueuedMessages);
                QueuedMessages.Clear();
            }

            foreach (var qpm in list)
            {
                SendMessage(qpm.Message, qpm.Callback);
            }
            return(list.Count);
        }