Commit cc62bed0 authored by Russ Cox's avatar Russ Cox

pipe: implementation #3; this time for sure!

Added goroutine; got simpler.

Fixes deadlock when doing Read+Close
or Write+Close on same end.

R=r, cw
CC=golang-dev
https://golang.org/cl/994043
parent 28c6305a
This diff is collapsed.
......@@ -207,6 +207,18 @@ func TestPipeReadClose(t *testing.T) {
}
}
// Test close on Read side during Read.
func TestPipeReadClose2(t *testing.T) {
c := make(chan int, 1)
r, _ := Pipe()
go delayClose(t, r, c, pipeTest{})
n, err := r.Read(make([]byte, 64))
<-c
if n != 0 || err != os.EINVAL {
t.Errorf("read from closed pipe: %v, %v want %v, %v", n, err, 0, os.EINVAL)
}
}
// Test write after/before reader close.
func TestPipeWriteClose(t *testing.T) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment