diff options
| author | Ian Lance Taylor <iant@golang.org> | 2017-02-10 14:59:38 -0800 |
|---|---|---|
| committer | Ian Lance Taylor <iant@golang.org> | 2017-02-13 18:36:28 +0000 |
| commit | 3792db518327c685da17ca6c6faa4e1d2da4c33c (patch) | |
| tree | 8d2456fa679526c8349a968aaf3cae09524aadfd /src/runtime/netpoll.go | |
| parent | b548eee3d96fc0b6e962a243b28121e1f37ad792 (diff) | |
| download | go-3792db518327c685da17ca6c6faa4e1d2da4c33c.tar.xz | |
net: refactor poller into new internal/poll package
This will make it possible to use the poller with the os package.
This is a lot of code movement but the behavior is intended to be
unchanged.
Update #6817.
Update #7903.
Update #15021.
Update #18507.
Change-Id: I1413685928017c32df5654ded73a2643820977ae
Reviewed-on: https://go-review.googlesource.com/36799
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: David Crawshaw <crawshaw@golang.org>
Reviewed-by: Russ Cox <rsc@golang.org>
Diffstat (limited to 'src/runtime/netpoll.go')
| -rw-r--r-- | src/runtime/netpoll.go | 32 |
1 files changed, 16 insertions, 16 deletions
diff --git a/src/runtime/netpoll.go b/src/runtime/netpoll.go index 10a3c88a09..ac8d071045 100644 --- a/src/runtime/netpoll.go +++ b/src/runtime/netpoll.go @@ -81,8 +81,8 @@ var ( pollcache pollCache ) -//go:linkname net_runtime_pollServerInit net.runtime_pollServerInit -func net_runtime_pollServerInit() { +//go:linkname poll_runtime_pollServerInit internal/poll.runtime_pollServerInit +func poll_runtime_pollServerInit() { netpollinit() atomic.Store(&netpollInited, 1) } @@ -91,8 +91,8 @@ func netpollinited() bool { return atomic.Load(&netpollInited) != 0 } -//go:linkname net_runtime_pollOpen net.runtime_pollOpen -func net_runtime_pollOpen(fd uintptr) (*pollDesc, int) { +//go:linkname poll_runtime_pollOpen internal/poll.runtime_pollOpen +func poll_runtime_pollOpen(fd uintptr) (*pollDesc, int) { pd := pollcache.alloc() lock(&pd.lock) if pd.wg != 0 && pd.wg != pdReady { @@ -115,8 +115,8 @@ func net_runtime_pollOpen(fd uintptr) (*pollDesc, int) { return pd, int(errno) } -//go:linkname net_runtime_pollClose net.runtime_pollClose -func net_runtime_pollClose(pd *pollDesc) { +//go:linkname poll_runtime_pollClose internal/poll.runtime_pollClose +func poll_runtime_pollClose(pd *pollDesc) { if !pd.closing { throw("netpollClose: close w/o unblock") } @@ -137,8 +137,8 @@ func (c *pollCache) free(pd *pollDesc) { unlock(&c.lock) } -//go:linkname net_runtime_pollReset net.runtime_pollReset -func net_runtime_pollReset(pd *pollDesc, mode int) int { +//go:linkname poll_runtime_pollReset internal/poll.runtime_pollReset +func poll_runtime_pollReset(pd *pollDesc, mode int) int { err := netpollcheckerr(pd, int32(mode)) if err != 0 { return err @@ -151,8 +151,8 @@ func net_runtime_pollReset(pd *pollDesc, mode int) int { return 0 } -//go:linkname net_runtime_pollWait net.runtime_pollWait -func net_runtime_pollWait(pd *pollDesc, mode int) int { +//go:linkname poll_runtime_pollWait internal/poll.runtime_pollWait +func poll_runtime_pollWait(pd *pollDesc, mode int) int { err := netpollcheckerr(pd, int32(mode)) if err != 0 { return err @@ -173,16 +173,16 @@ func net_runtime_pollWait(pd *pollDesc, mode int) int { return 0 } -//go:linkname net_runtime_pollWaitCanceled net.runtime_pollWaitCanceled -func net_runtime_pollWaitCanceled(pd *pollDesc, mode int) { +//go:linkname poll_runtime_pollWaitCanceled internal/poll.runtime_pollWaitCanceled +func poll_runtime_pollWaitCanceled(pd *pollDesc, mode int) { // This function is used only on windows after a failed attempt to cancel // a pending async IO operation. Wait for ioready, ignore closing or timeouts. for !netpollblock(pd, int32(mode), true) { } } -//go:linkname net_runtime_pollSetDeadline net.runtime_pollSetDeadline -func net_runtime_pollSetDeadline(pd *pollDesc, d int64, mode int) { +//go:linkname poll_runtime_pollSetDeadline internal/poll.runtime_pollSetDeadline +func poll_runtime_pollSetDeadline(pd *pollDesc, d int64, mode int) { lock(&pd.lock) if pd.closing { unlock(&pd.lock) @@ -251,8 +251,8 @@ func net_runtime_pollSetDeadline(pd *pollDesc, d int64, mode int) { } } -//go:linkname net_runtime_pollUnblock net.runtime_pollUnblock -func net_runtime_pollUnblock(pd *pollDesc) { +//go:linkname poll_runtime_pollUnblock internal/poll.runtime_pollUnblock +func poll_runtime_pollUnblock(pd *pollDesc) { lock(&pd.lock) if pd.closing { throw("netpollUnblock: already closing") |
