I only meant that the “socket closed” error is a good (perfect?) signal that 
the Go routine should exit rather than using an additional state var. 

> On Jul 6, 2020, at 6:43 PM, Ian Lance Taylor <i...@golang.org> wrote:
> 
> On Mon, Jul 6, 2020 at 4:23 PM robert engels <reng...@ix.netcom.com> wrote:
>> 
>> If you set the deadline to zero, don’t you need to use another flag to know 
>> that it “should be terminated”, otherwise you can’t know if the deadline 
>> exceeded was regular - I guess, unless you do a “get deadline” on the error 
>> and check for 0, but that seems racy ?
> 
> You're shutting down anyhow, I'm not sure it makes much difference.
> You already need some way to know that you are shutting down, such as
> checking a context or whatever.
> 
> But it's not a big deal.  I was only making the point that setting the
> deadline to zero will wake up the goroutine.
> 
> Ian
> 
> 
>> On Jul 6, 2020, at 1:36 PM, Ian Lance Taylor <i...@golang.org> wrote:
>> 
>> On Mon, Jul 6, 2020 at 10:57 AM Robert Engels <reng...@ix.netcom.com> wrote:
>> 
>> 
>> You need to close the socket from another Go routine. Otherwise the Reader 
>> api would need to be changed to always take a Context.
>> 
>> 
>> Either close the socket or set the deadline to zero.
>> 
>> Ian
>> 
>> 
>> On Jul 6, 2020, at 12:36 PM, Brian Candler <b.cand...@pobox.com> wrote:
>> 
>> 
>> On Monday, 6 July 2020 14:53:55 UTC+1, Ian Davis wrote:
>> 
>> 
>> Can you write your own ContextReader that checks ctx.Done in its Read method?
>> 
>> 
>> Inside a ContextReader I can check ctx.Done *before* calling the wrapped 
>> Read method - but if the context isn't done at that point and I called the 
>> wrapped Read, it will be blocked at that point.
>> 
>> --
>> 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.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/golang-nuts/5069054f-19db-4bbc-89b4-c2a6ff58a270o%40googlegroups.com.
>> 
>> --
>> 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.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/golang-nuts/75342356-0313-4CF9-BC27-F03871A4F2C8%40ix.netcom.com.
>> 
>> 

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/68ECD540-7836-40BE-BA10-38E713283CDD%40ix.netcom.com.

Reply via email to