public PipedMultiplexer(PipedStreamReader reader, PipedStreamOptions options)
        {
            if (reader == null)
            {
                throw new ArgumentNullException("reader");
            }

            _writers                     = new ConcurrentBag <Stream>();
            _reader                      = reader;
            _optionsTemplate             = options.Clone();
            _optionsTemplate.Multiplexed = false;

            _task = Task.Run(async() => await MultiplexerTask().IgnoreContext());
        }
        public PipedStreamManager(PipedStreamOptions options)
        {
            _options = options.Clone();
            _options.EnsureValidity();

            _writersCreated = 0;
            _readersCreated = 0;
            _multiplexer    = _options.Multiplexed ? new Lazy <PipedMultiplexer>(CreateMultiplexer, LazyThreadSafetyMode.ExecutionAndPublication) : null;

            _buffer = new PipeBufferFactory(_options.BlockSize, _options.MaxBlocks + 2);

            _pipe = new BufferBlock <IPipeBufferItem>(new DataflowBlockOptions()
            {
                EnsureOrdered   = true,
                BoundedCapacity = _options.MaxBlocks
            });
            _closeCalled = 0;
        }