From e0efaca8293aed238ae2bade3328f81aa69decc7 Mon Sep 17 00:00:00 2001 From: qiulaidongfeng <2645477756@qq.com> Date: Thu, 29 Aug 2024 11:01:26 +0800 Subject: [PATCH] new Change-Id: Iee83b60a107cc4a24fda9bf6e0c0fadacb1bec03 --- src/context/context.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/context/context.go b/src/context/context.go index fa679e4df2b..57bb416049b 100644 --- a/src/context/context.go +++ b/src/context/context.go @@ -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)