packages feed

auto-update 0.2.7 → 0.2.8

raw patch · 5 files changed

+21/−7 lines, 5 filesPVP ok

version bump matches the API change (PVP)

API changes (from Hackage documentation)

Files

ChangeLog.md view
@@ -1,5 +1,12 @@ # ChangeLog for auto-update +## 0.2.8++* use `atomicWriteIORef` instead of `writeIORef` in the following modules to+  avoid more issues: [#1112](https://github.com/yesodweb/wai/pull/1112)+    * `Control.Reaper` (`spawn` & `reaper`)+    * `Control.AutoUpdate.Event` (`getUpdateResult`)+ ## 0.2.7  * Use `atomicModifyIORef` in `mkAutoUpdate(Helper)` to prevent race conditions
Control/AutoUpdate/Event.hs view
@@ -119,6 +119,7 @@ getUpdateResult :: UpdateState a -> IO a getUpdateResult us@UpdateState{..} = do     onceOnTimeHasCome us $ do-        writeIORef usLastResult_ =<< usUpdateAction_ =<< readIORef usLastResult_-        writeIORef usDeleteTimeout_ =<< mkDeleteTimeout usTimeHasCome_ usIntervalMicro_+        atomicWriteIORef usLastResult_ =<< usUpdateAction_ =<< readIORef usLastResult_+        atomicWriteIORef usDeleteTimeout_+            =<< mkDeleteTimeout usTimeHasCome_ usIntervalMicro_     readIORef usLastResult_
Control/AutoUpdate/Thread.hs view
@@ -20,7 +20,7 @@     try,  ) import Control.Monad (void)-import Data.IORef (newIORef, readIORef, writeIORef, atomicWriteIORef)+import Data.IORef (atomicWriteIORef, newIORef, readIORef, writeIORef) import Data.Maybe (fromMaybe) import GHC.Conc.Sync (labelThread) 
Control/Reaper.hs view
@@ -45,7 +45,13 @@ import Control.Concurrent (ThreadId, forkIO, killThread, threadDelay) import Control.Exception (mask_) import Control.Reaper.Internal-import Data.IORef (IORef, atomicModifyIORef', newIORef, readIORef, writeIORef)+import Data.IORef (+    IORef,+    atomicModifyIORef',+    atomicWriteIORef,+    newIORef,+    readIORef,+ ) import GHC.Conc.Sync (labelThread)  -- | Settings for creating a reaper. This type has two parameters:@@ -190,7 +196,7 @@ spawn settings stateRef tidRef = do     tid <- forkIO $ reaper settings stateRef tidRef     labelThread tid $ reaperThreadName settings-    writeIORef tidRef $ Just tid+    atomicWriteIORef tidRef $ Just tid  reaper     :: ReaperSettings workload item@@ -211,7 +217,7 @@         then             reaper settings stateRef tidRef         else-            writeIORef tidRef Nothing+            atomicWriteIORef tidRef Nothing   where     swapWithEmpty NoReaper = error "Control.Reaper.reaper: unexpected NoReaper (1)"     swapWithEmpty (Workload wl) = (Workload reaperEmpty, wl)
auto-update.cabal view
@@ -1,5 +1,5 @@ name:                auto-update-version:             0.2.7+version:             0.2.8 synopsis:            Efficiently run periodic, on-demand actions description:         API docs and the README are available at <http://www.stackage.org/package/auto-update>. homepage:            https://github.com/yesodweb/wai