summaryrefslogtreecommitdiff
path: root/Utility/ThreadScheduler.hs
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2012-06-22 15:46:21 -0400
committerGravatar Joey Hess <joey@kitenet.net>2012-06-22 15:49:48 -0400
commite9630e90decac4fe0c999af88131bd4b7c9d979f (patch)
treed0d7d897ab63fe8d7d76b47771e9c7c34f08618f /Utility/ThreadScheduler.hs
parent28e28bc0436cb0a33e570b1a1f678e80a770a21a (diff)
the syncer now pushes out changes to remotes, in parallel
Note that, since this always pushes branch synced/master to the remote, it assumes that master has already gotten all the commits that are on the remote merged in. Otherwise, fast-forward prevention may prevent the push. That's probably ok, because the next stage is to automatically detect incoming pushes and merge.
Diffstat (limited to 'Utility/ThreadScheduler.hs')
-rw-r--r--Utility/ThreadScheduler.hs6
1 files changed, 6 insertions, 0 deletions
diff --git a/Utility/ThreadScheduler.hs b/Utility/ThreadScheduler.hs
index 6557398fd..07a740160 100644
--- a/Utility/ThreadScheduler.hs
+++ b/Utility/ThreadScheduler.hs
@@ -24,6 +24,12 @@ runEvery n a = forever $ do
threadDelaySeconds n
a
+runEveryWith :: Seconds -> a -> (a -> IO a) -> IO ()
+runEveryWith n val a = do
+ threadDelaySeconds n
+ val' <- a val
+ runEveryWith n val' a
+
threadDelaySeconds :: Seconds -> IO ()
threadDelaySeconds (Seconds n) = unboundDelay (fromIntegral n * oneSecond)
where