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).

Ian

-- 
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.

Reply via email to