예제 #1
0
 public Block?Take()
 {
     _semaphore.Wait();
     try
     {
         return(_core.Take());
     }
     finally
     {
         _semaphore.Release();
     }
 }
예제 #2
0
        public IterationResult Iterate()
        {
            var block = _source.Take();

            if (block == null)
            {
                return(IterationResult.Break);
            }

            var processedBlock = _processor.Process(block);

            _sink.Put(processedBlock);

            return(IterationResult.Continue);
        }
예제 #3
0
 public static IEnumerable <Block> TakeAll(this IBlockSource Reader)
 {
     while (true)
     {
         var block = Reader.Take();
         if (block != null)
         {
             yield return(block);
         }
         else
         {
             yield break;
         }
     }
 }