diff options
author | 2012-06-26 17:33:34 -0400 | |
---|---|---|
committer | 2012-06-26 19:21:44 -0400 | |
commit | 67c8ef7de25ad6f433db2fa5d5fc764dd515a5b2 (patch) | |
tree | 3666619b0752df6c336fdbac270e09dbd125bcec /Assistant.hs | |
parent | e0a65247aebb8a821f4f0b717d39a4a35136a2e6 (diff) |
use a TMVar
SampleMVar won't work; between getting the current value and changing
it, another thread could made a change, which would get lost.
TMVar works well; this update situation is handled by atomic transactions.
Diffstat (limited to 'Assistant.hs')
-rw-r--r-- | Assistant.hs | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/Assistant.hs b/Assistant.hs index c054dafd3..4f8a868f4 100644 --- a/Assistant.hs +++ b/Assistant.hs @@ -53,6 +53,9 @@ - CommitChan: (STM TChan) - Commits are indicated by writing to this channel. The pusher reads - from it. + - FailedPushMap (STM TMVar) + - Failed pushes are indicated by writing to this TMVar. The push + - retrier blocks until they're available. -} module Assistant where @@ -89,10 +92,10 @@ startDaemon assistant foreground liftIO $ a $ do changechan <- newChangeChan commitchan <- newCommitChan - pushchan <- newFailedPushChan + pushmap <- newFailedPushMap _ <- forkIO $ commitThread st changechan commitchan - _ <- forkIO $ pushThread st commitchan pushchan - _ <- forkIO $ pushRetryThread st pushchan + _ <- forkIO $ pushThread st commitchan pushmap + _ <- forkIO $ pushRetryThread st pushmap _ <- forkIO $ mergeThread st _ <- forkIO $ daemonStatusThread st dstatus _ <- forkIO $ sanityCheckerThread st dstatus changechan |