aboutsummaryrefslogtreecommitdiff
path: root/src/runtime/select.go
diff options
context:
space:
mode:
Diffstat (limited to 'src/runtime/select.go')
-rw-r--r--src/runtime/select.go11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/runtime/select.go b/src/runtime/select.go
index b3a3085cb0..17c49d7484 100644
--- a/src/runtime/select.go
+++ b/src/runtime/select.go
@@ -173,6 +173,10 @@ func selectgo(cas0 *scase, order0 *uint16, pc0 *uintptr, nsends, nrecvs int, blo
continue
}
+ if cas.c.timer != nil {
+ cas.c.timer.maybeRunChan()
+ }
+
j := cheaprandn(uint32(norder + 1))
pollorder[norder] = pollorder[j]
pollorder[j] = uint16(i)
@@ -315,6 +319,10 @@ func selectgo(cas0 *scase, order0 *uint16, pc0 *uintptr, nsends, nrecvs int, blo
} else {
c.recvq.enqueue(sg)
}
+
+ if c.timer != nil {
+ blockTimerChan(c)
+ }
}
// wait for someone to wake us up
@@ -351,6 +359,9 @@ func selectgo(cas0 *scase, order0 *uint16, pc0 *uintptr, nsends, nrecvs int, blo
for _, casei := range lockorder {
k = &scases[casei]
+ if k.c.timer != nil {
+ unblockTimerChan(k.c)
+ }
if sg == sglist {
// sg has already been dequeued by the G that woke us up.
casi = int(casei)