]> Cypherpunks.ru repositories - gostls13.git/commit
runtime: make NumGoroutine and Stack agree not to include system goroutines
authorRuss Cox <rsc@golang.org>
Thu, 7 Jan 2016 02:16:01 +0000 (21:16 -0500)
committerRuss Cox <rsc@golang.org>
Fri, 8 Jan 2016 15:25:00 +0000 (15:25 +0000)
commitc5bafc828126c8fa057e1accaa448583c7ec145f
treeda2f0d6aeff112177491851ba3a4541836abed8b
parent20d745c57cb44e6ca8f29179e9cb928fad3a5cb4
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>
src/runtime/mprof.go
src/runtime/proc.go
src/runtime/proc_test.go
src/runtime/runtime2.go
src/runtime/testdata/testprog/misc.go [new file with mode: 0644]