mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
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>
15 lines
307 B
Go
15 lines
307 B
Go
// Copyright 2016 The Go Authors. All rights reserved.
|
|
// Use of this source code is governed by a BSD-style
|
|
// license that can be found in the LICENSE file.
|
|
|
|
package main
|
|
|
|
import "runtime"
|
|
|
|
func init() {
|
|
register("NumGoroutine", NumGoroutine)
|
|
}
|
|
|
|
func NumGoroutine() {
|
|
println(runtime.NumGoroutine())
|
|
}
|