io-sim 1.9.0.0 → 1.9.1.0
raw patch · 3 files changed
+10/−13 lines, 3 filesdep ~base
Dependency ranges changed: base
Files
- CHANGELOG.md +5/−3
- io-sim.cabal +1/−1
- src/Control/Monad/IOSim/Types.hs +4/−9
CHANGELOG.md view
@@ -1,10 +1,12 @@ # Revision history of io-sim -## next release--### Breaking changes+## 1.9.1.0 ### Non-breaking changes++* Reverted rounding of `si-timers` API to microsecond to match `IO` behaviour.+ It may cause surprising issues downstream when time is not advancing as+ expected because of rounding to `0`. ## 1.9.0.0
io-sim.cabal view
@@ -1,6 +1,6 @@ cabal-version: 3.4 name: io-sim-version: 1.9.0.0+version: 1.9.1.0 synopsis: A pure simulator for monadic concurrency with STM. description: A pure simulator monad with support of concurrency (base & async style), stm,
src/Control/Monad/IOSim/Types.hs view
@@ -725,8 +725,7 @@ instance SI.MonadDelay (IOSim s) where threadDelay d =- IOSim $ oneShot $ \k -> ThreadDelay (SI.roundDiffTimeToMicroseconds d)- (k ())+ IOSim $ oneShot $ \k -> ThreadDelay d (k ()) data Timeout s = Timeout !(TVar s TimeoutState) !TimeoutId -- ^ a timeout@@ -766,15 +765,11 @@ timeout d action | d < 0 = Just <$> action | d == 0 = return Nothing- | otherwise = IOSim $ oneShot $ \k ->- StartTimeout (SI.roundDiffTimeToMicroseconds d)- (runIOSim action)- k+ | otherwise = IOSim $ oneShot $ \k -> StartTimeout d (runIOSim action) k - registerDelay d = IOSim $ oneShot $ \k ->- RegisterDelay (SI.roundDiffTimeToMicroseconds d) k+ registerDelay d = IOSim $ oneShot $ \k -> RegisterDelay d k registerDelayCancellable d = do- t <- newTimeout (SI.roundDiffTimeToMicroseconds d)+ t <- newTimeout d return (readTimeout t, cancelTimeout t) newtype TimeoutException = TimeoutException TimeoutId deriving Eq