mirror of
https://github.com/golang/go
synced 2024-11-21 23:34:42 -07:00
new
Change-Id: Iee83b60a107cc4a24fda9bf6e0c0fadacb1bec03
This commit is contained in:
parent
6acb9f1a47
commit
e0efaca829
@ -378,8 +378,8 @@ func parentCancelCtx(parent Context) (*cancelCtx, bool) {
|
|||||||
if !ok {
|
if !ok {
|
||||||
return nil, false
|
return nil, false
|
||||||
}
|
}
|
||||||
pdone, _ := p.done.Load().(chan struct{})
|
pdone := p.done.Load()
|
||||||
if pdone != done {
|
if pdone != nil && *pdone != done {
|
||||||
return nil, false
|
return nil, false
|
||||||
}
|
}
|
||||||
return p, true
|
return p, true
|
||||||
@ -546,7 +546,7 @@ func (c *cancelCtx) cancel(removeFromParent bool, err, cause error) {
|
|||||||
c.err = err
|
c.err = err
|
||||||
c.cause = cause
|
c.cause = cause
|
||||||
d := c.done.Load()
|
d := c.done.Load()
|
||||||
if *d == nil {
|
if d == nil {
|
||||||
c.done.Store(&closedchan)
|
c.done.Store(&closedchan)
|
||||||
} else {
|
} else {
|
||||||
close(*d)
|
close(*d)
|
||||||
|
Loading…
Reference in New Issue
Block a user