Oops! ::blush:: On Tue, Feb 21, 2017 at 11:39 AM Axel Wagner <axel.wagner...@googlemail.com> wrote:
> Wrong list :) You meant to link here: > https://godoc.org/context#Context.Err > > On Tue, Feb 21, 2017 at 8:15 PM, 'Thomas Bushnell, BSG' via golang-nuts < > golang-nuts@googlegroups.com> wrote: > > On Mon, Feb 20, 2017 at 11:42 AM Ian Lance Taylor <i...@golang.org> wrote: > > On Sun, Feb 19, 2017 at 2:57 PM, <so.qu...@gmail.com> wrote: > > Thanks, I see you build it up with decorators on a standard prototype. > > For example: https://play.golang.org/p/PJy5lE9QqF > > > > So context.Done is a convenience function for those that require it? > > Otherwise a context will expire after it leaves scope, so Done does not > need > > to be called? > > Cancelling the context just marks the context as cancelled. It does > not actually stop any goroutines using the context. Those goroutines > must themselves periodically check the context to see whether it has > been cancelled, and, if so, stop working. They do that by calling > either the Done or Err method; it's much more common to call the Done > method (and check whether the channel is closed). > > > Calling the Err() method to see if the context has been cancelled is > incorrect. See > https://godoc.corp.google.com/pkg/google3/go/context/context#Context.Err: > "Err's return value is unspecified before Done is closed." > > Thomas > > -- > > You received this message because you are subscribed to the Google Groups > "golang-nuts" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to golang-nuts+unsubscr...@googlegroups.com. > For more options, visit https://groups.google.com/d/optout. > > -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.