@@ -11,6 +11,7 @@ import Reflex.Dom.PerformEvent.Class
1111import Reflex.Dom.PostBuild.Class
1212
1313import Control.Concurrent
14+import qualified Control.Concurrent.Thread.Delay as Concurrent
1415import Control.Monad
1516import Control.Monad.Fix
1617import Control.Monad.IO.Class
@@ -51,7 +52,7 @@ tickLossyFrom dt t0 e = do
5152 return result
5253 where callAtNextInterval _ cb = void $ liftIO $ forkIO $ do
5354 tick <- getCurrentTick dt t0
54− threadDelay $ ceiling $ (dt - _tickInfo_alreadyElapsed tick) * 1000000
55+ Concurrent.delay $ ceiling $ (dt - _tickInfo_alreadyElapsed tick) * 1000000
5556 cb tick
5657
5758clockLossy :: (MonadIO m, PerformEvent t m, TriggerEvent t m, MonadIO (Performable m), PostBuild t m, MonadHold t m, MonadFix m) => NominalDiffTime -> UTCTime -> m (Dynamic t TickInfo)
@@ -70,7 +71,7 @@ getCurrentTick dt t0 = do
7071-- | Delay an Event's occurrences by a given amount in seconds.
7172delay :: (PerformEvent t m, TriggerEvent t m, MonadIO (Performable m)) => NominalDiffTime -> Event t a -> m (Event t a)
7273delay dt e = performEventAsync $ ffor e $ \a cb -> liftIO $ void $ forkIO $ do
73− threadDelay $ ceiling $ dt * 1000000
74+ Concurrent.delay $ ceiling $ dt * 1000000
7475 cb a
7576
7677-- | Send events with Poisson timing with the given basis and rate
@@ -157,7 +158,7 @@ inhomogeneousPoissonFrom rnd rate maxRate t0 e = do
157158 alreadyElapsed = diffUTCTime t tTargetLast
158159 tTarget = addUTCTime dt tTargetLast
159160 thisDelay = realToFrac $ diffUTCTime tTarget t :: Double
160− threadDelay $ ceiling $ thisDelay * 1000000
161+ Concurrent.delay $ ceiling $ thisDelay * 1000000
161162 _ <- cb (TickInfo t nEvents alreadyElapsed, p)
162163 go tTarget nextGen' cb nEvents
163164