]> Cypherpunks repositories - gostls13.git/commit
runtime: omit nil-channel cases from selectgo's orders
authorMatthew Dempsky <mdempsky@google.com>
Mon, 27 Jul 2020 21:47:47 +0000 (14:47 -0700)
committerMatthew Dempsky <mdempsky@google.com>
Tue, 18 Aug 2020 20:05:47 +0000 (20:05 +0000)
commit8a984e8e3f2cf4101f448ea9b9d9880b9e83c11e
tree3a27605d7088b5aa9a94cddd7f9e1faae51e7b61
parent78a1064d5dd05fc669342df3a6a5e11d49749d85
runtime: omit nil-channel cases from selectgo's orders

Currently, selectgo does an initial pass over the cases array to look
for entries with nil channels, so they can be easily recognized and
skipped later on. But this still involves actually visiting the cases.

This commit changes selectgo to omit cases with nil channels when
constructing pollorder, so that they'll be skipped over entirely later
on. It also checks for caseDefault up front, which will facilitate
changing it to use a "block bool" parameter instead.

Updates #40410.

Change-Id: Icaebcb8f08df03cc33b6d8087616fb5585f7fedd
Reviewed-on: https://go-review.googlesource.com/c/go/+/245123
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
src/runtime/select.go