public override void Write(byte[] buffer, int offset, int count) { lock (_readLocker) { int writeCount = Math.Min((int)WriteableCount, count - offset); while (offset < count) { if (!IsWriteable) { _isWritingStalled = true; lock (_writeLocker) { Monitor.Exit(_readLocker); Monitor.Wait(_writeLocker); Monitor.Enter(_readLocker); } _isWritingStalled = false; if (_closed) { break; } } _buffer.Put(buffer, offset, writeCount); offset += writeCount; writeCount = Math.Min((int)WriteableCount, count - offset); Monitor.Pulse(_readLocker); } } }
public override void Write(byte[] buffer, int offset, int count) { _buffer.Put(buffer, offset, count); }