aboutsummaryrefslogtreecommitdiff
path: root/src/runtime
diff options
context:
space:
mode:
authorAustin Clements <austin@google.com>2016-03-17 14:08:32 -0400
committerAustin Clements <austin@google.com>2016-03-17 18:57:10 +0000
commit857d0b48dbdf8b41dc5fe4823cd81a8a5298c1eb (patch)
treeddc8e78b7068110d95010cf485714c804a7845e8 /src/runtime
parentac74e5debc884ea4545e23c3248385f0d683524a (diff)
downloadgo-857d0b48dbdf8b41dc5fe4823cd81a8a5298c1eb.tar.xz
runtime: document sudog
Change-Id: I85c0bcf02842cc32dbc9bfdcea27efe871173574 Reviewed-on: https://go-review.googlesource.com/20774 Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Diffstat (limited to 'src/runtime')
-rw-r--r--src/runtime/runtime2.go10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/runtime/runtime2.go b/src/runtime/runtime2.go
index 89774791eb..a54dc552c1 100644
--- a/src/runtime/runtime2.go
+++ b/src/runtime/runtime2.go
@@ -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