> > On Tuesday, August 30, 2016 at 8:46:23 PM UTC+3, seb....@gmail.com wrote:
> >>
> >> In my application I select on a ticker channel, but sometimes need to 
> >> have the waiting time vary a bit. For not so frequent changes I could make 
> >> a new ticker everytime, but I have the feeling this is not the best 
> >> solution for higher frequencies and many rate changes. Best would be if I 
> >> could tell my existing ticker "from next tick on please use an interval of 
> >> x". In fact what I want is that the frequency changes over time.
> >>
> >> Any tips how to achieve that?

Does this do what you want?

https://play.golang.org/p/302HPhYn89

With the current code, t.C can be passed around, but SetDuration must
always be called from the same goroutine.  With a little work (and a
mutex) you could make SetDuration safe for concurrent use.

...Marvin

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