]> Cypherpunks repositories - gostls13.git/commitdiff
runtime: document sudog
authorAustin Clements <austin@google.com>
Thu, 17 Mar 2016 18:08:32 +0000 (14:08 -0400)
committerAustin Clements <austin@google.com>
Thu, 17 Mar 2016 18:57:10 +0000 (18:57 +0000)
Change-Id: I85c0bcf02842cc32dbc9bfdcea27efe871173574
Reviewed-on: https://go-review.googlesource.com/20774
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
src/runtime/runtime2.go

index 89774791ebce2d32f6a6e205def325f436f366fe..a54dc552c1f15b593abd29b0b5455e6c6da48f8d 100644 (file)
@@ -210,6 +210,16 @@ type gobuf struct {
        bp   uintptr // for GOEXPERIMENT=framepointer
 }
 
+// sudog represents a g in a wait list, such as for sending/receiving
+// on a channel.
+//
+// sudog is necessary because the g ↔ synchronization object relation
+// is many-to-many. A g can be on many wait lists, so there may be
+// many sudogs for one g; and many gs may be waiting on the same
+// synchronization object, so there may be many sudogs for one object.
+//
+// sudogs are allocated from a special pool. Use acquireSudog and
+// releaseSudog to allocate and free them.
 type sudog struct {
        // The following fields are protected by the hchan.lock of the
        // channel this sudog is blocking on. shrinkstack depends on