Beispiel #1
0
        public void ChangeQueuePriority(Guid queue, int priority)
        {
            QueueBuffer queueBuffer = null;

            lock (queueBuffers)
            {
                if (queueBuffers.ContainsKey(queue))
                {
                    queueBuffer = queueBuffers[queue];
                    queueBuffer.CurrentPriority = priority;
                }
            }
        }
Beispiel #2
0
 private QueueBuffer[] CopyQueueBuffersToArray()
 {
     QueueBuffer[] buffers = null;
     lock (queueBuffers)
     {
         var queueCount = queueBuffers.Count;
         buffers = new QueueBuffer[queueCount];
         int index = 0;
         foreach (var queueBuffer in queueBuffers)
         {
             buffers[index++] = queueBuffer.Value;
         }
     }
     return(buffers);
 }
Beispiel #3
0
        private byte[] GetBufferForQueue(Guid queue, int priority)
        {
            QueueBuffer queueBuffer = null;

            lock (queueBuffers)
            {
                if (queueBuffers.ContainsKey(queue))
                {
                    queueBuffer = queueBuffers[queue];
                    queueBuffer.CurrentPriority = priority;
                    return(queueBuffer.Buffer);
                }
            }
            return(null);
        }
Beispiel #4
0
 public QueueBuffer CreateQueue(Guid queue, int priority)
 {
     lock (queueBuffers)
     {
         QueueBuffer queueBuffer = null;
         if (!queueBuffers.ContainsKey(queue))
         {
             queueBuffer = new QueueBuffer(busLength);
             queueBuffer.CurrentPriority = priority;
             queueBuffers.Add(queue, queueBuffer);
         }
         else
         {
             queueBuffer = queueBuffers[queue];
         }
         return(queueBuffer);
     }
 }