time-manager 0.0.0 → 0.0.1
raw patch · 3 files changed
+20/−10 lines, 3 filesdep +unliftiodep ~auto-updatedep ~basesetup-changed
Dependencies added: unliftio
Dependency ranges changed: auto-update, base
Files
- Setup.hs +0/−2
- System/TimeManager.hs +15/−5
- time-manager.cabal +5/−3
− Setup.hs
@@ -1,2 +0,0 @@-import Distribution.Simple-main = defaultMain
System/TimeManager.hs view
@@ -10,6 +10,7 @@ , stopManager , killManager , withManager+ , withManager' -- ** Registration , register , registerKillThread@@ -23,7 +24,7 @@ ) where import Control.Concurrent (myThreadId)-import qualified Control.Exception as E+import qualified UnliftIO.Exception as E import Control.Reaper import Data.Typeable (Typeable) import Data.IORef (IORef)@@ -143,10 +144,19 @@ ---------------------------------------------------------------- -- | Call the inner function with a timeout manager.+-- 'stopManager' is used after that. withManager :: Int -- ^ timeout in microseconds -> (Manager -> IO a) -> IO a-withManager timeout f = do- -- FIXME when stopManager is available, use it- man <- initialize timeout- f man+withManager timeout f = E.bracket (initialize timeout)+ stopManager+ f++-- | Call the inner function with a timeout manager.+-- 'killManager' is used after that.+withManager' :: Int -- ^ timeout in microseconds+ -> (Manager -> IO a)+ -> IO a+withManager' timeout f = E.bracket (initialize timeout)+ killManager+ f
time-manager.cabal view
@@ -1,5 +1,5 @@ Name: time-manager-Version: 0.0.0+Version: 0.0.1 Synopsis: Scalable timer License: MIT License-file: LICENSE@@ -8,12 +8,14 @@ Homepage: http://github.com/yesodweb/wai Category: System Build-Type: Simple-Cabal-Version: >=1.8+Cabal-Version: >=1.10 Stability: Stable Description: Scalable timer functions provided by a timer manager. Library- Build-Depends: base >= 4.8 && < 5+ Build-Depends: base >= 4.12 && < 5 , auto-update+ , unliftio+ Default-Language: Haskell2010 Exposed-modules: System.TimeManager Ghc-Options: -Wall