diff options
| author | Russ Cox <rsc@golang.org> | 2016-01-06 21:16:01 -0500 |
|---|---|---|
| committer | Russ Cox <rsc@golang.org> | 2016-01-08 15:25:00 +0000 |
| commit | c5bafc828126c8fa057e1accaa448583c7ec145f (patch) | |
| tree | da2f0d6aeff112177491851ba3a4541836abed8b /src/runtime/runtime2.go | |
| parent | 20d745c57cb44e6ca8f29179e9cb928fad3a5cb4 (diff) | |
| download | go-c5bafc828126c8fa057e1accaa448583c7ec145f.tar.xz | |
runtime: make NumGoroutine and Stack agree not to include system goroutines
Before, NumGoroutine counted system goroutines and Stack (usually) didn't show them,
which was inconsistent and confusing.
To resolve which way they should be consistent, it seems like
package main
import "runtime"
func main() { println(runtime.NumGoroutine()) }
should print 1 regardless of internal runtime details. Make it so.
Fixes #11706.
Change-Id: I6bfe26a901de517728192cfb26a5568c4ef4fe47
Reviewed-on: https://go-review.googlesource.com/18343
Reviewed-by: Austin Clements <austin@google.com>
Diffstat (limited to 'src/runtime/runtime2.go')
| -rw-r--r-- | src/runtime/runtime2.go | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/src/runtime/runtime2.go b/src/runtime/runtime2.go index d9a449b68b..a4ad749d25 100644 --- a/src/runtime/runtime2.go +++ b/src/runtime/runtime2.go @@ -418,6 +418,8 @@ type schedt struct { mcount int32 // number of m's that have been created maxmcount int32 // maximum number of m's allowed (or die) + ngsys uint32 // number of system goroutines; updated atomically + pidle puintptr // idle p's npidle uint32 nmspinning uint32 // See "Worker thread parking/unparking" comment in proc.go. |
