Fixed bug in SharedWriter.
diff --git a/shared_writer.go b/shared_writer.go
index aa8b4e2..b4a280e 100644
--- a/shared_writer.go
+++ b/shared_writer.go
@@ -29,7 +29,7 @@
 		previous := this.written.Load()
 		upper := previous + count
 
-		if previous-this.capacity > this.gate.Load() {
+		for upper-this.capacity > this.gate.Load() {
 			this.gate.Store(this.upstream.Read(0))
 		}