aboutsummaryrefslogtreecommitdiff
path: root/src/runtime/chan.go
diff options
context:
space:
mode:
authorRuss Cox <rsc@golang.org>2016-10-20 09:11:20 -0400
committerRuss Cox <rsc@golang.org>2016-10-24 15:59:28 +0000
commit39690beb5885d378d98117c3d57b494e97f16eea (patch)
tree5127f8bb64f95379d5d20df65d0a31678507d084 /src/runtime/chan.go
parent2693fa15ee12acd67e45d8fa57626675903ab605 (diff)
downloadgo-39690beb5885d378d98117c3d57b494e97f16eea.tar.gz
go-39690beb5885d378d98117c3d57b494e97f16eea.zip
runtime: fix invariant comment in chan.go
Change-Id: Ic6317f186d0ee68ab1f2d15be9a966a152f61bfb Reviewed-on: https://go-review.googlesource.com/31610 Run-TryBot: Russ Cox <rsc@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Keith Randall <khr@golang.org>
Diffstat (limited to 'src/runtime/chan.go')
-rw-r--r--src/runtime/chan.go8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/runtime/chan.go b/src/runtime/chan.go
index 712ad8cef9..261d37d4ee 100644
--- a/src/runtime/chan.go
+++ b/src/runtime/chan.go
@@ -7,10 +7,16 @@ package runtime
// This file contains the implementation of Go channels.
// Invariants:
-// At least one of c.sendq and c.recvq is empty.
+// At least one of c.sendq and c.recvq is empty,
+// except for the case of an unbuffered channel with a single goroutine
+// blocked on it for both sending and receiving using a select statement,
+// in which case the length of c.sendq and c.recvq is limited only by the
+// size of the select statement.
+//
// For buffered channels, also:
// c.qcount > 0 implies that c.recvq is empty.
// c.qcount < c.dataqsiz implies that c.sendq is empty.
+
import (
"runtime/internal/atomic"
"unsafe"