Re: [go-nuts] Timer.Reset() (again...)

2020-04-04 Thread Leszek Kubik
I have nothing to comment about timer.Reset() but your pseudo code made me wonder if there's an interval timer available in the library, and of course it is. In the example you aim to do some work periodically, until another type of work succeeds. That's not a plain meaning of a timeout. In

Re: [go-nuts] Timer.Reset() (again...)

2020-04-01 Thread Neil Schellenberger
Thank you very much for confirming that, Ian! FWIW the scenario is very roughly along the lines of a "best effort re-configurable" timeout for a work loop: timeout := <-timeoutConfigC timer := time.NewTimer(timeout) defer timer.Stop() for { select { case timeout = <-timeoutConfigC:

Re: [go-nuts] Timer.Reset() (again...)

2020-04-01 Thread Ian Lance Taylor
On Wed, Apr 1, 2020 at 11:05 AM Neil Schellenberger wrote: > > I am almost certainly overthinking this or in some other way "doing it > wrong"--so please (dis)abuse me. > > The Timer.Reset() documentation reads (in part) "Reset should be invoked only > on stopped or expired timers with drained

[go-nuts] Timer.Reset() (again...)

2020-04-01 Thread Neil Schellenberger
Hi Folks, I am almost certainly overthinking this or in some other way "doing it wrong"--so please (dis)abuse me. The Timer.Reset() documentation reads (in part) "Reset should be invoked only on stopped or expired timers with drained channels." Am I correct in understanding that "should" in