Perhaps line 51 should be:
sec := time.Duration(rand.ExpFloat64() * float64(t.period))
to get
tick. (0s)
tick. (5.872982ms)
tick. (5.37282ms)
tick. (12.310533ms)
...
instead of
tick. (0s)
tick. (0s)
tick. (10ms)
tick. (30ms)
tick. (0s)
tick. (0s)
Den onsdag 26 september 2018 kl. 17:33:29 UTC+2
Both use the runtime timers underneath. Ticker requires an extra channel
send.
Tracking this down was interesting!
On Thu, 27 Sep 2018, 14:56 David Wahlstedt,
wrote:
> I mean that an ordinary go thread executing a sleep instruction may risk
> to be starved by the scheduler, so the real
I mean that an ordinary go thread executing a sleep instruction may risk to
be starved by the scheduler, so the real sleeping time is likely to be
longer. But with the ticker, a incoming message in the channel waking up a
routine that waits for it, things may behave differently?
/David
Den
On Wed, Sep 26, 2018 at 2:29 PM David Wahlstedt <
david.wahlstedt@gmail.com> wrote:
> Thanks--nice!
> Will this be less reliable than the built-in Ticker (that uses
> runtimeTimer), besides the intentional randomness?
>
modulo the possible bug(s) I may have unintentionally introduced, I
Thanks--nice!
Will this be less reliable than the built-in Ticker (that uses
runtimeTimer), besides the intentional randomness?
/David
Den tisdag 25 september 2018 kl. 18:43:33 UTC+2 skrev Sebastien Binet:
>
>
>
> On Tue, Sep 25, 2018 at 11:34 AM David Wahlstedt > wrote:
>
>> Hi,
>> What would
On Tue, Sep 25, 2018 at 11:34 AM David Wahlstedt <
david.wahlstedt@gmail.com> wrote:
> Hi,
> What would be a nice way to implement a ticker that generates events
> according to a Poisson process?
> The built-in Ticker in ticker.go uses a runtimeTimer that has a field
> called period.
> I