aboutsummaryrefslogtreecommitdiff
path: root/src/runtime/os_plan9.go
diff options
context:
space:
mode:
authorDavid du Colombier <0intro@gmail.com>2016-11-11 20:49:11 +0100
committerBrad Fitzpatrick <bradfitz@golang.org>2016-11-12 05:44:36 +0000
commitadb384ad2cfbd742fb106b7ec2a65d4ad844c35e (patch)
tree4e0f7ff6c497cafae18822a2079fdb384b8b6996 /src/runtime/os_plan9.go
parent456f2f5cb8c2e06e7faba6ba298ffb65c7a19397 (diff)
downloadgo-adb384ad2cfbd742fb106b7ec2a65d4ad844c35e.tar.gz
go-adb384ad2cfbd742fb106b7ec2a65d4ad844c35e.zip
net: implement asynchonous cancelable I/O on Plan 9
This change is an experimental implementation of asynchronous cancelable I/O operations on Plan 9, which are required to implement deadlines. There are no asynchronous syscalls on Plan 9. I/O operations are performed with blocking pread and pwrite syscalls. Implementing deadlines in Go requires a way to interrupt I/O operations. It is possible to interrupt reads and writes on a TCP connection by forcing the closure of the TCP connection. This approach has been used successfully in CL 31390. However, we can't implement deadlines with this method, since we require to be able to reuse the connection after the timeout. On Plan 9, I/O operations are interrupted when the process receives a note. We can rely on this behavior to implement a more generic approach. When doing an I/O operation (read or write), we start the I/O in its own process, then wait for the result asynchronously. The process is able to handle the "hangup" note. When receiving the "hangup" note, the currently running I/O operation is canceled and the process returns. This way, deadlines can be implemented by sending an "hangup" note to the process running the blocking I/O operation, after the expiration of a timer. Fixes #11932. Fixes #17498. Change-Id: I414f72c7a9a4f9b8f9c09ed3b6c269f899d9b430 Reviewed-on: https://go-review.googlesource.com/31521 Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Diffstat (limited to 'src/runtime/os_plan9.go')
-rw-r--r--src/runtime/os_plan9.go1
1 files changed, 1 insertions, 0 deletions
diff --git a/src/runtime/os_plan9.go b/src/runtime/os_plan9.go
index 032aec1a46..ba2d5c5525 100644
--- a/src/runtime/os_plan9.go
+++ b/src/runtime/os_plan9.go
@@ -13,6 +13,7 @@ type mOS struct {
waitsemacount uint32
notesig *int8
errstr *byte
+ ignoreHangup bool
}
func closefd(fd int32) int32