summaryrefslogtreecommitdiff
path: root/Assistant/ThreadedMonad.hs
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2012-07-18 19:13:56 -0400
committerGravatar Joey Hess <joey@kitenet.net>2012-07-18 19:15:34 -0400
commitcf47bb3f509ae63ad868b66c0b6f2baecb93e4c7 (patch)
tree60bfdab5cf877c4de206146c65e759f82cdf2e85 /Assistant/ThreadedMonad.hs
parenteea0a3616cd1cbaf033649c11a5c2b650b6b632f (diff)
run file transfers in threads, not processes
This should fix OSX/BSD issues with not noticing transfer information files with kqueue. Now that threads are used, the thread can manage the transfer slot allocation and deallocation by itself; much cleaner.
Diffstat (limited to 'Assistant/ThreadedMonad.hs')
-rw-r--r--Assistant/ThreadedMonad.hs9
1 files changed, 4 insertions, 5 deletions
diff --git a/Assistant/ThreadedMonad.hs b/Assistant/ThreadedMonad.hs
index 2fc526599..1decd8e91 100644
--- a/Assistant/ThreadedMonad.hs
+++ b/Assistant/ThreadedMonad.hs
@@ -37,14 +37,13 @@ withThreadState a = do
runThreadState :: ThreadState -> Annex a -> IO a
runThreadState mvar a = modifyMVar mvar $ \state -> swap <$> Annex.run state a
-{- Runs an Annex action in a separate thread, using a copy of the state
- - from the MVar.
+{- Runs an Annex action, using a copy of the state from the MVar.
-
- It's up to the action to perform any necessary shutdown tasks in order
- for state to not be lost. And it's up to the caller to resynchronise
- with any changes the action makes to eg, the git-annex branch.
-}
-unsafeForkIOThreadState :: ThreadState -> Annex a -> IO ThreadId
-unsafeForkIOThreadState mvar a = do
+unsafeRunThreadState :: ThreadState -> Annex a -> IO ()
+unsafeRunThreadState mvar a = do
state <- readMVar mvar
- forkIO $ void $ Annex.eval state a
+ void $ Annex.eval state a