]> Cypherpunks repositories - gostls13.git/commitdiff
runtime: improve comment on selectgo
authorAustin Clements <austin@google.com>
Wed, 17 Feb 2016 18:43:19 +0000 (13:43 -0500)
committerAustin Clements <austin@google.com>
Mon, 14 Mar 2016 16:29:21 +0000 (16:29 +0000)
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>
src/runtime/select.go

index 4e87dba3e72e99000a1682cd83ac48ac7b122441..ddc3d81638ef6a0b8f5a29e8ea40023a40531b8f 100644 (file)
@@ -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)