1
0
mirror of https://github.com/golang/go synced 2024-11-24 12:10:03 -07:00
Change-Id: Iee83b60a107cc4a24fda9bf6e0c0fadacb1bec03
This commit is contained in:
qiulaidongfeng 2024-08-29 11:01:26 +08:00
parent 6acb9f1a47
commit e0efaca829

View File

@ -378,8 +378,8 @@ func parentCancelCtx(parent Context) (*cancelCtx, bool) {
if !ok {
return nil, false
}
pdone, _ := p.done.Load().(chan struct{})
if pdone != done {
pdone := p.done.Load()
if pdone != nil && *pdone != done {
return nil, false
}
return p, true
@ -546,7 +546,7 @@ func (c *cancelCtx) cancel(removeFromParent bool, err, cause error) {
c.err = err
c.cause = cause
d := c.done.Load()
if *d == nil {
if d == nil {
c.done.Store(&closedchan)
} else {
close(*d)