diff options
| author | Michael Pratt <mpratt@google.com> | 2024-01-29 23:57:14 +0000 |
|---|---|---|
| committer | Gopher Robot <gobot@golang.org> | 2024-01-30 00:16:58 +0000 |
| commit | 4afb155cdf5cd6e8b133174d3369c4db4ea23c77 (patch) | |
| tree | 744951083379f67f4fa0e8893649980136d0b5c5 /src/net | |
| parent | f96d9a643202b9f28fad3756d0de8ac6b5c159dd (diff) | |
| download | go-4afb155cdf5cd6e8b133174d3369c4db4ea23c77.tar.xz | |
Revert "runtime: disable use of runnext on wasm"
This reverts CL 557437.
Reason for revert: Appears to have broken wasip1 builders.
For #65178.
Change-Id: I59c1a310eb56589c768536fe444c1efaf862f8b0
Reviewed-on: https://go-review.googlesource.com/c/go/+/559237
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Michael Pratt <mpratt@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Diffstat (limited to 'src/net')
| -rw-r--r-- | src/net/net_fake.go | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/src/net/net_fake.go b/src/net/net_fake.go index f7eb28e01a..2d1e137b6d 100644 --- a/src/net/net_fake.go +++ b/src/net/net_fake.go @@ -14,6 +14,7 @@ import ( "errors" "io" "os" + "runtime" "sync" "sync/atomic" "syscall" @@ -516,6 +517,14 @@ func (pq *packetQueue) send(dt *deadlineTimer, b []byte, from sockaddr, block bo full = pq.full } + // Before we check dt.expired, yield to other goroutines. + // This may help to prevent starvation of the goroutine that runs the + // deadlineTimer's time.After callback. + // + // TODO(#65178): Remove this when the runtime scheduler no longer starves + // runnable goroutines. + runtime.Gosched() + select { case <-dt.expired: return 0, os.ErrDeadlineExceeded @@ -567,6 +576,14 @@ func (pq *packetQueue) recvfrom(dt *deadlineTimer, b []byte, wholePacket bool, c empty = pq.empty } + // Before we check dt.expired, yield to other goroutines. + // This may help to prevent starvation of the goroutine that runs the + // deadlineTimer's time.After callback. + // + // TODO(#65178): Remove this when the runtime scheduler no longer starves + // runnable goroutines. + runtime.Gosched() + select { case <-dt.expired: return 0, nil, os.ErrDeadlineExceeded |
