]> Cypherpunks repositories - gostls13.git/commit
internal/poll: don't take read lock in SetBlocking
authorIan Lance Taylor <iant@golang.org>
Tue, 10 Jul 2018 23:44:56 +0000 (16:44 -0700)
committerIan Lance Taylor <iant@golang.org>
Wed, 11 Jul 2018 00:34:18 +0000 (00:34 +0000)
commit8d6fc84986cc0cb0bf77503828a2e7740f8ccac1
treedb9d85bfa7bdf8d26deeb39c31029bd507a2556d
parente86bbc2e27bc584c23acee7f26d6d5b8d27f143a
internal/poll: don't take read lock in SetBlocking

Taking a read lock in SetBlocking could cause SetBlocking to block
waiting for a Read in another goroutine to complete. Since SetBlocking
is called by os.(*File).Fd, that could lead to deadlock if the
goroutine calling Fd is going to use it to unblock the Read.
Use an atomic store instead.

Updates #24481

Change-Id: I79413328e06ddf28b6d5b8af7a0e29d5b4e1e6ff
Reviewed-on: https://go-review.googlesource.com/123176
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
src/cmd/dist/test.go
src/internal/poll/fd_unix.go
src/os/pipe_test.go