diff options
author | Austin Clements <austin@google.com> | 2016-02-17 13:43:19 -0500 |
---|---|---|
committer | Austin Clements <austin@google.com> | 2016-03-14 16:29:21 +0000 |
commit | 5a50e003067672ff13bc2ea0464f0cf83a943b2d (patch) | |
tree | 8fe8c3e4cf1f894c400f19580a84485d8b095df4 /src/runtime/select.go | |
parent | 8a2d6e9f6fd2f9e5b06add7e1c958ee6d3051ca7 (diff) | |
download | go-5a50e003067672ff13bc2ea0464f0cf83a943b2d.tar.gz go-5a50e003067672ff13bc2ea0464f0cf83a943b2d.zip |
runtime: improve comment on selectgo
In particular, document that *sel is on the stack no matter what.
Change-Id: I1c264215e026c27721b13eedae73ec845066cdec
Reviewed-on: https://go-review.googlesource.com/20032
Reviewed-by: Rick Hudson <rlh@golang.org>
Diffstat (limited to 'src/runtime/select.go')
-rw-r--r-- | src/runtime/select.go | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/src/runtime/select.go b/src/runtime/select.go index 4e87dba3e7..ddc3d81638 100644 --- a/src/runtime/select.go +++ b/src/runtime/select.go @@ -208,8 +208,15 @@ func block() { gopark(nil, nil, "select (no cases)", traceEvGoStop, 1) // forever } -// overwrites return pc on stack to signal which case of the select -// to run, so cannot appear at the top of a split stack. +// selectgo implements the select statement. +// +// *sel is on the current goroutine's stack (regardless of any +// escaping in selectgo). +// +// selectgo does not return. Instead, it overwrites its return PC and +// returns directly to the triggered select case. Because of this, it +// cannot appear at the top of a split stack. +// //go:nosplit func selectgo(sel *hselect) { pc, offset := selectgoImpl(sel) |