aboutsummaryrefslogtreecommitdiff
path: root/src/runtime/chan.go
diff options
context:
space:
mode:
authorDaniel Martí <mvdan@mvdan.cc>2019-03-05 20:21:17 +0000
committerDaniel Martí <mvdan@mvdan.cc>2019-03-05 20:31:32 +0000
commit340129e4c8c56a371859b7434de89478610cab81 (patch)
treeddb925e1793805a8de08091ce9dfc05fd5637bb3 /src/runtime/chan.go
parenta125bdb49b9aa96f3185ae4dfcc0f6d13b998724 (diff)
downloadgo-340129e4c8c56a371859b7434de89478610cab81.tar.gz
go-340129e4c8c56a371859b7434de89478610cab81.zip
all: join a few chained ifs
I had been finding these over a year or so, but none were big enough changes to warrant CLs. They're a handful now, so clean them all up in a single commit. The smaller bodies get a bit simpler, but most importantly, the larger bodies get unindented. Change-Id: I5707a6fee27d4c9ff9efd3d363af575d7a4bf2aa Reviewed-on: https://go-review.googlesource.com/c/go/+/165340 Run-TryBot: Daniel Martí <mvdan@mvdan.cc> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org>
Diffstat (limited to 'src/runtime/chan.go')
-rw-r--r--src/runtime/chan.go6
1 files changed, 2 insertions, 4 deletions
diff --git a/src/runtime/chan.go b/src/runtime/chan.go
index 8662f00e13..389bf799e2 100644
--- a/src/runtime/chan.go
+++ b/src/runtime/chan.go
@@ -729,10 +729,8 @@ func (q *waitq) dequeue() *sudog {
// We use a flag in the G struct to tell us when someone
// else has won the race to signal this goroutine but the goroutine
// hasn't removed itself from the queue yet.
- if sgp.isSelect {
- if !atomic.Cas(&sgp.g.selectDone, 0, 1) {
- continue
- }
+ if sgp.isSelect && !atomic.Cas(&sgp.g.selectDone, 0, 1) {
+ continue
}
return sgp