mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
runtime: replace manually managed G dequeues with a type
There are two manually managed G dequeues. Abstract these both into a shared gQueue type. This also introduces a gList type, which we'll use to replace several manually-managed G lists in follow-up CLs. This makes the code more readable and maintainable. gcFlushBgCredit in particular becomes much easier to follow. It also makes it easier to introduce more G queues in the future. Finally, the gList type clearly distinguishes between lists of Gs and individual Gs; currently both are represented by a *g, which can easily lead to confusion and bugs. Change-Id: Ic7798841b405d311fc8b6aa5a958ffa4c7993c6c Reviewed-on: https://go-review.googlesource.com/129396 Run-TryBot: Austin Clements <austin@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Rick Hudson <rlh@golang.org>
This commit is contained in:
parent
723479bc30
commit
3578918b66
4 changed files with 128 additions and 68 deletions
|
|
@ -574,8 +574,7 @@ type schedt struct {
|
|||
nmspinning uint32 // See "Worker thread parking/unparking" comment in proc.go.
|
||||
|
||||
// Global runnable queue.
|
||||
runqhead guintptr
|
||||
runqtail guintptr
|
||||
runq gQueue
|
||||
runqsize int32
|
||||
|
||||
// Global cache of dead G's.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue