Commit a034f310 authored by Austin Clements's avatar Austin Clements

runtime: use gList in closechan

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: default avatarRick Hudson <rlh@golang.org>
parent 083938df
...@@ -343,7 +343,7 @@ func closechan(c *hchan) { ...@@ -343,7 +343,7 @@ func closechan(c *hchan) {
c.closed = 1 c.closed = 1
var glist *g var glist gList
// release all readers // release all readers
for { for {
...@@ -363,8 +363,7 @@ func closechan(c *hchan) { ...@@ -363,8 +363,7 @@ func closechan(c *hchan) {
if raceenabled { if raceenabled {
raceacquireg(gp, unsafe.Pointer(c)) raceacquireg(gp, unsafe.Pointer(c))
} }
gp.schedlink.set(glist) glist.push(gp)
glist = gp
} }
// release all writers (they will panic) // release all writers (they will panic)
...@@ -382,15 +381,13 @@ func closechan(c *hchan) { ...@@ -382,15 +381,13 @@ func closechan(c *hchan) {
if raceenabled { if raceenabled {
raceacquireg(gp, unsafe.Pointer(c)) raceacquireg(gp, unsafe.Pointer(c))
} }
gp.schedlink.set(glist) glist.push(gp)
glist = gp
} }
unlock(&c.lock) unlock(&c.lock)
// Ready all Gs now that we've dropped the channel lock. // Ready all Gs now that we've dropped the channel lock.
for glist != nil { for !glist.empty() {
gp := glist gp := glist.pop()
glist = glist.schedlink.ptr()
gp.schedlink = 0 gp.schedlink = 0
goready(gp, 3) goready(gp, 3)
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment