@@ -69,17 +69,8 @@ poissonLossyFrom
6969 -- there could be uses for starting multiple timer threads.
7070 -- Start sending events in response to the event parameter.
7171 -> m (Event t TickInfo)
72−poissonLossyFrom rnd rate t0 e = performEventAsync $ fmap callAtNextInterval e
73− where callAtNextInterval _ cb = void $ liftIO $ forkIO $ go rnd cb
74− go lastGen cb = do
75− t <- getCurrentTime
76− let (u, nextGen) = randomR (0,1) lastGen
77− dt = realToFrac $ -1 * log(u)/rate :: NominalDiffTime
78− offset = t `diffUTCTime` t0
79− (n, alreadyElapsed) = offset `divMod'` dt
80− threadDelay $ ceiling $ (dt - alreadyElapsed) * 1000000
81− void $ cb $ TickInfo t n alreadyElapsed
82− go nextGen cb
72+poissonLossyFrom rnd rate t0 t =
73+ inhomogeneousPoissonFrom rnd (current $ constDyn rate) rate t0 t
8374
8475
8576-- | Send events with Poisson timing with the given basis and rate