mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
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>
This commit is contained in:
parent
20d745c57c
commit
c5bafc8281
5 changed files with 47 additions and 1 deletions
|
|
@ -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.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue