]> Cypherpunks repositories - gostls13.git/commit
net: remove race condition on Close.
authorAdam Langley <agl@golang.org>
Wed, 18 Nov 2009 21:18:34 +0000 (13:18 -0800)
committerAdam Langley <agl@golang.org>
Wed, 18 Nov 2009 21:18:34 +0000 (13:18 -0800)
commitef8f483c60830a088d5fdc473621dc85a96efe40
tree844d2e1abebe8ddc01d432c02bf5d3ca3e6f7a44
parent9e8d136888f269a6ff8060e44e8a50e4f50474be
net: remove race condition on Close.

Previously a netFd could be queued for reading/writing in the channel,
but close(2)'ed before pollServer got to it. In this case, the kernel
would consider the descriptor closed and the attempt to add it to the
epoll set would fail and panic.

This patch makes Close a roundtrip to the pollServer, although the
actual close(2) still occurs elsewhere to avoid blocking the
pollServer.

Fixes #143.

R=rsc
CC=golang-dev
https://golang.org/cl/152130
src/pkg/net/fd.go