Re: [go-nuts] context package: why need run goroutine in propagateCancel function

2021-04-26 Thread qinggeer Bao
Thanks. I see. 在2021年4月27日星期二 UTC+8 上午5:50:09 写道: > On Mon, Apr 26, 2021 at 9:59 AM qinggeer Bao wrote: > > > > if parentCancelCtx return false, it means no cancellable ancestors > found, then why do we need run another goroutine to listen for parent's > cancel signals? How it can happen in wh

Re: [go-nuts] context package: why need run goroutine in propagateCancel function

2021-04-26 Thread Ian Lance Taylor
On Mon, Apr 26, 2021 at 9:59 AM qinggeer Bao wrote: > > if parentCancelCtx return false, it means no cancellable ancestors found, > then why do we need run another goroutine to listen for parent's cancel > signals? How it can happen in what kind of cases? See the documentation of parentCancelCt

[go-nuts] context package: why need run goroutine in propagateCancel function

2021-04-26 Thread qinggeer Bao
For learning purpose, I'm reading the source code of Golang standard package: context. Roughly understand the logics with one confusing point in the propagateCancel below: func propagateCancel(parent Context, child canceler) { done := parent.Done() if done == nil { return // pare