Added dependency on unbounded-delays
authorJoey Hess <joeyh@joeyh.name>
Tue, 27 Feb 2024 17:11:59 +0000 (13:11 -0400)
committerJoey Hess <joeyh@joeyh.name>
Tue, 27 Feb 2024 17:11:59 +0000 (13:11 -0400)
And stop vendoring part of it.

This is a free dependency because tasty depends on it.

Sponsored-by: Leon Schuermann on Patreon
CHANGELOG
COPYRIGHT
Utility/ThreadScheduler.hs
git-annex.cabal

index 05ecb54c62d9496aabd0a85e66aae7e04188cdc6..2f454f0a192b4c1532cdd6e8642f58c4fb67fa71 100644 (file)
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -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
index c047f4173edd10d71b52317a9a8f40dc904daff9..a41e2d603ac3e11a757d1272bee6a8799e698f93 100644 (file)
--- a/COPYRIGHT
+++ b/COPYRIGHT
@@ -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
index 9ab94d911efa44af21a06361d5daa8b735d0ae85..245605b0b4f6e8a4992a20f148f5e8b616c6ba3a 100644 (file)
@@ -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 ()
index fea72b95dd9aa1fdfd7bc5e4aa6f4907a71f1b27..448ae067fb26684f893e5981a8e6f68292c2a4b2 100644 (file)
@@ -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,