On Tue, Feb 21, 2017 at 11:15 AM, Thomas Bushnell, BSG
<
tbus...@google.com> wrote:
> On Mon, Feb 20, 2017 at 11:42 AM Ian Lance Taylor <
ia...@golang.org> wrote:
>>
>> On Sun, Feb 19, 2017 at 2:57 PM, <
so.q...@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.
in the Go standard library. Perhaps it should be.