Added dependency on unbounded-delays
And stop vendoring part of it. This is a free dependency because tasty depends on it. Sponsored-by: Leon Schuermann on Patreon
This commit is contained in:
parent
cf1411fabe
commit
c2d6c02c27
4 changed files with 11 additions and 20 deletions
|
@ -1,3 +1,9 @@
|
|||
git-annex (10.20240228) UNRELEASED; urgency=medium
|
||||
|
||||
* Added dependency on unbounded-delays.
|
||||
|
||||
-- Joey Hess <id@joeyh.name> Tue, 27 Feb 2024 13:07:10 -0400
|
||||
|
||||
git-annex (10.20240227) upstream; urgency=medium
|
||||
|
||||
* importfeed: Added --scrape option, which uses yt-dlp to screen scrape
|
||||
|
|
|
@ -33,11 +33,6 @@ Copyright: © 2011-2020 Joey Hess <id@joeyh.name>
|
|||
© 2014 Robie Basak <robie@justgohome.co.uk>
|
||||
License: GPL-3+
|
||||
|
||||
Files: Utility/ThreadScheduler.hs
|
||||
Copyright: 2011 Bas van Dijk & Roel van Dijk
|
||||
2012, 2013 Joey Hess <id@joeyh.name>
|
||||
License: BSD-2-clause
|
||||
|
||||
Files: Utility/Attoparsec.hs
|
||||
Copyright: 2019 Joey Hess <id@joeyh.name>
|
||||
2007-2015 Bryan O'Sullivan
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
{- thread scheduling
|
||||
-
|
||||
- Copyright 2012, 2013 Joey Hess <id@joeyh.name>
|
||||
- Copyright 2011 Bas van Dijk & Roel van Dijk
|
||||
- Copyright 2012-2024 Joey Hess <id@joeyh.name>
|
||||
-
|
||||
- License: BSD-2-clause
|
||||
-}
|
||||
|
@ -20,6 +19,7 @@ module Utility.ThreadScheduler (
|
|||
|
||||
import Control.Monad
|
||||
import Control.Concurrent
|
||||
import qualified Control.Concurrent.Thread.Delay as Unbounded
|
||||
#ifndef mingw32_HOST_OS
|
||||
import Control.Monad.IfElse
|
||||
import System.Posix.IO
|
||||
|
@ -44,20 +44,9 @@ runEvery n a = forever $ do
|
|||
threadDelaySeconds :: Seconds -> IO ()
|
||||
threadDelaySeconds (Seconds n) = unboundDelay (fromIntegral n * oneSecond)
|
||||
|
||||
{- Like threadDelay, but not bounded by an Int.
|
||||
-
|
||||
- There is no guarantee that the thread will be rescheduled promptly when the
|
||||
- delay has expired, but the thread will never continue to run earlier than
|
||||
- specified.
|
||||
-
|
||||
- Taken from the unbounded-delay package to avoid a dependency for 4 lines
|
||||
- of code.
|
||||
-}
|
||||
{- Like threadDelay, but not bounded by an Int. -}
|
||||
unboundDelay :: Microseconds -> IO ()
|
||||
unboundDelay time = do
|
||||
let maxWait = min time $ toInteger (maxBound :: Int)
|
||||
threadDelay $ fromInteger maxWait
|
||||
when (maxWait /= time) $ unboundDelay (time - maxWait)
|
||||
unboundDelay = Unbounded.delay
|
||||
|
||||
{- Pauses the main thread, letting children run until program termination. -}
|
||||
waitForTermination :: IO ()
|
||||
|
|
|
@ -267,6 +267,7 @@ Executable git-annex
|
|||
split,
|
||||
attoparsec (>= 0.13.2.2),
|
||||
concurrent-output (>= 1.10),
|
||||
unbounded-delays,
|
||||
QuickCheck (>= 2.10.0),
|
||||
tasty (>= 1.2),
|
||||
tasty-hunit,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue