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 that sentence means that if neither condition holds then calling Reset() nevertheless still results in legal, well defined behaviour? I.e. "should" (lest you e.g. unintentionally race) not "must" (lest you e.g. hang). >From inspection of the implementation it appears that the only real consequence of the inherent race is that it might result in either the "old" or "new" expiry being delivered on the next receive. And even if the "old" expiry is still pending in the (buffered, size one) channel when the runtime attempts to deliver the "new" expiry, the "new" expiry is simply dropped rather than causing any type of deadlock or similar grief to the runtime (i.e. per sendTime(), literally the same callback as for time.Ticker). I apologise in advance for further belabouring this hoary chestnut ([1][2][3] et multa al. e.g. in StackExchange, Reddit etc.) but I've gotten myself thoroughly confused as to what is *guaranteed* by the specification. Taken precisely as written, the admonishments are simply cautions--particularly when read in conjunction with the Timer.Stop() documentation (which uses less proscriptive lanaguage). But they are so lengthy that they left me with the nagging sense that there might be something more subtle and dire lurking behind that I was failing to grasp. (I.e. no matter how carefully written the documentation some b*gger--me--will always misunderstand, misinterpret, or otherwise misconstrue it.) Regards, Neil [1] https://github.com/golang/go/issues/14383 [2] https://github.com/golang/go/issues/11513 [3] https://groups.google.com/forum/#!topic/golang-dev/c9UUfASVPoU -- 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/b1bbffe7-594d-400d-ac73-686e43548807%40googlegroups.com.