diff options
author | Joey Hess <joey@kitenet.net> | 2012-07-05 16:07:49 -0600 |
---|---|---|
committer | Joey Hess <joey@kitenet.net> | 2012-07-05 16:07:49 -0600 |
commit | 9eaba58dd9706fde7e0fb84364a16576db63a7e0 (patch) | |
tree | 87abc8edd03d98d026e75fc411258f3169ebd0f9 /Assistant/ThreadedMonad.hs | |
parent | 2136ee4adbeba262dcf184e653e1e07acb02a2bd (diff) |
run transfer with copy of annex state
This should have made it run concurrently with other annex actions,
but I'm still seeing it serialize. Perhaps I need to forkProcess?
Diffstat (limited to 'Assistant/ThreadedMonad.hs')
-rw-r--r-- | Assistant/ThreadedMonad.hs | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/Assistant/ThreadedMonad.hs b/Assistant/ThreadedMonad.hs index 7b915e12c..4e871ab67 100644 --- a/Assistant/ThreadedMonad.hs +++ b/Assistant/ThreadedMonad.hs @@ -36,3 +36,15 @@ withThreadState a = do - time. -} runThreadState :: ThreadState -> Annex a -> IO a runThreadState mvar a = modifyMVar mvar $ \state -> swap <$> Annex.run state a + +{- Runs an Annex action, using a copy of the state from the MVar. + - + - The state modified by the action is thrown away, so 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. + -} +unsafeRunThreadState :: ThreadState -> Annex a -> IO a +unsafeRunThreadState mvar a = do + state <- readMVar mvar + Annex.eval state a |