예제 #1
0
        public bool TryDequeue(out CompressionBlock block)
        {
            bool result = false;

            lock (_lock)
            {
                result = LockedTryDequeue(out block);
                Monitor.Pulse(_lock);
            }
            return(result);
        }
예제 #2
0
 protected override void LockedEnqeue(CompressionBlock block)
 {
     while (_queue.Count >= Capacity)
     {
         if (IsClosed)
         {
             return;
         }
         Monitor.Wait(_lock);
     }
     _queue.Enqueue(block);
     Monitor.Pulse(_lock);
 }
예제 #3
0
 protected override bool LockedTryDequeue(out CompressionBlock block)
 {
     block = null;
     while (_queue.Count == 0)
     {
         if (IsClosed)
         {
             return(false);
         }
         Monitor.Wait(_lock);
     }
     block = _queue.Dequeue();
     return(true);
 }
예제 #4
0
 protected override void LockedEnqeue(CompressionBlock block)
 {
     while (_queue.Count >= Capacity || _processedBlocks != block.Id)
     {
         if (IsClosed)
         {
             return;
         }
         Monitor.Wait(_lock);
     }
     _queue.Enqueue(block);
     _processedBlocks++;
     Monitor.PulseAll(_lock);
 }
예제 #5
0
 protected abstract bool LockedTryDequeue(out CompressionBlock block);
예제 #6
0
 protected abstract void LockedEnqeue(CompressionBlock block);
예제 #7
0
 public void Enqueue(CompressionBlock block)
 {
     lock (_lock) LockedEnqeue(block);
 }