Change-Id: I8148eb17fe9f2cbb659c35d84cdd212b46dc23bf
Reviewed-on: https://go-review.googlesource.com/129401
Run-TryBot: Austin Clements <austin@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Rick Hudson <rlh@golang.org>
c.closed = 1
- var glist *g
+ var glist gList
// release all readers
for {
if raceenabled {
raceacquireg(gp, unsafe.Pointer(c))
}
- gp.schedlink.set(glist)
- glist = gp
+ glist.push(gp)
}
// release all writers (they will panic)
if raceenabled {
raceacquireg(gp, unsafe.Pointer(c))
}
- gp.schedlink.set(glist)
- glist = gp
+ glist.push(gp)
}
unlock(&c.lock)
// Ready all Gs now that we've dropped the channel lock.
- for glist != nil {
- gp := glist
- glist = glist.schedlink.ptr()
+ for !glist.empty() {
+ gp := glist.pop()
gp.schedlink = 0
goready(gp, 3)
}