Closed manchurio closed 2 years ago
if runtimeReadgstatus(gp) == gDead || runtimeIsSystemGoroutine(gp, false) { continue }
在系统调用/cgo/新建g的时候, g的状态也是gDead, 是否不应该在这里过滤掉gDead状态的g 因为这里的g状态虽然是dead,但等一会还是会恢复成runnable 如cgo调用
此处逻辑参考了runtime.Stack的内部实现。
runtime.Stack
gDead表示协程just exited或just being initialized,它此时没有独立的stack,不被视为有效的协程。
gDead
just exited
just being initialized
在系统调用/cgo/新建g的时候, g的状态也是gDead, 是否不应该在这里过滤掉gDead状态的g 因为这里的g状态虽然是dead,但等一会还是会恢复成runnable 如cgo调用