public static void ComputeHashes(SyncQueue <Block> input, SyncQueue <Block> output)
 {
     try
     {
         Block block;
         while (input.TryDequeue(out block))
         {
             block.ComputeHash();
             output.Enqueue(block);
         }
     }
     catch (Exception ex)
     {
         fault = true; // signal producer to stop
         Console.WriteLine(ex.ToString());
     }
     finally
     {
         output.Close();
     }
 }
 public static void ReadFile(SyncQueue <Block> output, string filePath, long blockSize)
 {
     try
     {
         foreach (var block in FileReader.GetNextBlock(filePath, blockSize))
         {
             if (fault)
             {
                 break;        // stop if any errors occurred while consuming
             }
             output.Enqueue(block);
         }
     }
     catch (Exception ex)
     {
         Console.WriteLine(ex.ToString());
     }
     finally
     {
         output.Close();
     }
 }