aboutsummaryrefslogtreecommitdiff
path: root/src/runtime/netpoll_windows.go
AgeCommit message (Collapse)Author
2020-04-10runtime: replace the type of netpollWakeSig from a uintptr to a uint32Andy Pan
There's no need for netpollWakeSig to use a uintptr type, a uint32 is enough. Relevant CL: CL 212737 Change-Id: Ide24478b217a02bad62f7e000a9680c26a8c5366 Reviewed-on: https://go-review.googlesource.com/c/go/+/227798 Run-TryBot: Ian Lance Taylor <iant@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org>
2020-03-27runtime: converge duplicate calls to netpollBreak into oneAndy Pan
There might be some concurrent (maybe not concurrent, just sequential but in a short time window) and duplicate calls to `netpollBreak`, trying to wake up a net-poller. If one has called `netpollBreak` and that waking event hasn't been received by epollwait/kevent/..., then the subsequent calls of `netpollBreak` ought to be ignored or in other words, these calls should be converged into one. Benchmarks go1.13.5 darwin/amd64: benchmark-func time/op (old) time/op (new) delta BenchmarkNetpollBreak-4 29668ns ±1% 3131ns ±2% -89.45% mem/B (old) mem/B (new) delta 154B ±13% 0B ±0% -100% Change-Id: I3cf757a5d6edc5a99adad7aea3baee4b7f2a8f5c GitHub-Last-Rev: 15bcfbab8a5db51f65da01315a5880a5dbf9e028 GitHub-Pull-Request: golang/go#36294 Reviewed-on: https://go-review.googlesource.com/c/go/+/212737 Run-TryBot: Emmanuel Odeke <emm.odeke@gmail.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org>
2020-03-24runtime: always use GetQueuedCompletionStatusEx on WindowsIan Lance Taylor
We used to fall back to GetQueuedCompletionStatus if GetQueuedCompletionStatus was not available, but as of Go 1.11 we require Windows 7 or later, so GetQueuedCompletionStatusEx is always available. Fixes #37957 Change-Id: I7d8d49a92ab7b1f5afdc54a442f696aaf4a5168e Reviewed-on: https://go-review.googlesource.com/c/go/+/225059 Run-TryBot: Ian Lance Taylor <iant@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Alex Brainman <alex.brainman@gmail.com>
2019-10-21runtime: add netpollBreakIan Lance Taylor
The new netpollBreak function can be used to interrupt a blocking netpoll. This function is not currently used; it will be used by later CLs. Updates #27707 Change-Id: I5cb936609ba13c3c127ea1368a49194fc58c9f4d Reviewed-on: https://go-review.googlesource.com/c/go/+/171824 Run-TryBot: Ian Lance Taylor <iant@golang.org> Reviewed-by: Michael Knyszek <mknyszek@google.com>
2019-10-15runtime: change netpoll to take an amount of time to blockIan Lance Taylor
This new facility will be used by future CLs in this series. Change the only blocking call to netpoll to do the right thing when netpoll returns an empty list. Updates #6239 Updates #27707 Change-Id: I58b3c2903eda61a3698b1a4729ed0e81382bb1ed Reviewed-on: https://go-review.googlesource.com/c/go/+/171821 Run-TryBot: Ian Lance Taylor <iant@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Michael Knyszek <mknyszek@google.com> Reviewed-by: Emmanuel Odeke <emm.odeke@gmail.com>
2018-08-20runtime: use gList in netpollAustin Clements
netpoll is perhaps one of the most confusing uses of G lists currently since it passes around many lists as bare *g values right now. Switching to gList makes it much clearer what's an individual g and what's a list. Change-Id: I8d8993c4967c5bae049c7a094aad3a657928ba6c Reviewed-on: https://go-review.googlesource.com/129397 Run-TryBot: Austin Clements <austin@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Rick Hudson <rlh@golang.org>
2017-10-24runtime: make errno positive in netpollopenAlex Brainman
Make netpollopen return what Windows GetLastError API returns. It is probably copy / paste error from long time ago. Change-Id: I28f78718c15fef3e8b5f5d11a259533d7e9c6185 Reviewed-on: https://go-review.googlesource.com/72592 Reviewed-by: Ian Lance Taylor <iant@golang.org> Run-TryBot: Ian Lance Taylor <iant@golang.org>
2017-04-25runtime: adjust netpoll panic messagesMikio Hara
Change-Id: I34547b057605bb9e1e2227c41867589348560244 Reviewed-on: https://go-review.googlesource.com/41513 Run-TryBot: Mikio Hara <mikioh.mikioh@gmail.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org>
2017-02-15os: use poller for file I/OIan Lance Taylor
This changes the os package to use the runtime poller for file I/O where possible. When a system call blocks on a pollable descriptor, the goroutine will be blocked on the poller but the thread will be released to run other goroutines. When using a non-pollable descriptor, the os package will continue to use thread-blocking system calls as before. For example, on GNU/Linux, the runtime poller uses epoll. epoll does not support ordinary disk files, so they will continue to use blocking I/O as before. The poller will be used for pipes. Since this means that the poller is used for many more programs, this modifies the runtime to only block waiting for the poller if there is some goroutine that is waiting on the poller. Otherwise, there is no point, as the poller will never make any goroutine ready. This preserves the runtime's current simple deadlock detection. This seems to crash FreeBSD systems, so it is disabled on FreeBSD. This is issue 19093. Using the poller on Windows requires opening the file with FILE_FLAG_OVERLAPPED. We should only do that if we can remove that flag if the program calls the Fd method. This is issue 19098. Update #6817. Update #7903. Update #15021. Update #18507. Update #19093. Update #19098. Change-Id: Ia5197dcefa7c6fbcca97d19a6f8621b2abcbb1fe Reviewed-on: https://go-review.googlesource.com/36800 Run-TryBot: Ian Lance Taylor <iant@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Russ Cox <rsc@golang.org>
2017-02-13net: refactor poller into new internal/poll packageIan Lance Taylor
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>
2016-03-07runtime: eliminate unnecessary type conversionsMatthew Dempsky
Automated refactoring produced using github.com/mdempsky/unconvert. Change-Id: Iacf871a4f221ef17f48999a464ab2858b2bbaa90 Reviewed-on: https://go-review.googlesource.com/20071 Reviewed-by: Austin Clements <austin@google.com> Run-TryBot: Matthew Dempsky <mdempsky@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org>
2015-04-20runtime: replace func-based write barrier skipping with type-basedRuss Cox
This CL revises CL 7504 to use explicitly uintptr types for the struct fields that are going to be updated sometimes without write barriers. The result is that the fields are now updated *always* without write barriers. This approach has two important properties: 1) Now the GC never looks at the field, so if the missing reference could cause a problem, it will do so all the time, not just when the write barrier is missed at just the right moment. 2) Now a write barrier never happens for the field, avoiding the (correct) detection of inconsistent write barriers when GODEBUG=wbshadow=1. Change-Id: Iebd3962c727c0046495cc08914a8dc0808460e0e Reviewed-on: https://go-review.googlesource.com/9019 Reviewed-by: Austin Clements <austin@google.com> Run-TryBot: Russ Cox <rsc@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org>
2015-02-12runtime: move all stdFunctions into os1_windows.go (no code changes)Alex Brainman
Change-Id: I40291561a18bed3ca6be9dca12a664bdf28cb2f1 Reviewed-on: https://go-review.googlesource.com/4660 Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2014-12-28runtime: rename gothrow to throwKeith Randall
Rename "gothrow" to "throw" now that the C version of "throw" is no longer needed. This change is purely mechanical except in panic.go where the old version of "throw" has been deleted. sed -i "" 's/[[:<:]]gothrow[[:>:]]/throw/g' runtime/*.go Change-Id: Icf0752299c35958b92870a97111c67bcd9159dc3 Reviewed-on: https://go-review.googlesource.com/2150 Reviewed-by: Minux Ma <minux@golang.org> Reviewed-by: Dave Cheney <dave@cheney.net>
2014-11-20[dev.cc] runtime: convert remaining windows C code to GoAlex Brainman
LGTM=rsc R=rsc CC=golang-codereviews https://golang.org/cl/177090043
2014-11-17[dev.cc] runtime: replace deleted netpollfd functionAlex Brainman
LGTM=rsc R=rsc CC=golang-codereviews https://golang.org/cl/169710043
2014-11-14[dev.cc] runtime: convert netpoll_windows.c to GoAlex Brainman
LGTM=rsc R=rsc CC=dvyukov, golang-codereviews https://golang.org/cl/172530043