diff options
author | Joey Hess <joey@kitenet.net> | 2012-09-06 14:56:04 -0400 |
---|---|---|
committer | Joey Hess <joey@kitenet.net> | 2012-09-06 14:56:04 -0400 |
commit | a00f1d26bc3f121e49ee3f6ff5f46d7b330161ff (patch) | |
tree | 1951e9ca7e482fc67f9c232b0fb22680ee19f5a0 /Assistant.hs | |
parent | d11ded822cf68d4f33a886e0f97f95a3781e0dc1 (diff) |
display errors when any named thread crashes
Diffstat (limited to 'Assistant.hs')
-rw-r--r-- | Assistant.hs | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/Assistant.hs b/Assistant.hs index 1488a3b82..7f38fdf25 100644 --- a/Assistant.hs +++ b/Assistant.hs @@ -110,6 +110,7 @@ import Assistant.Pushes import Assistant.ScanRemotes import Assistant.TransferQueue import Assistant.TransferSlots +import Assistant.Threads.DaemonStatus import Assistant.Threads.Watcher import Assistant.Threads.Committer import Assistant.Threads.Pusher @@ -132,6 +133,8 @@ import Utility.ThreadScheduler import Control.Concurrent +type NamedThread = IO () -> IO (String, IO ()) + stopDaemon :: Annex () stopDaemon = liftIO . Utility.Daemon.stopDaemon =<< fromRepo gitAnnexPidFile @@ -162,7 +165,7 @@ startAssistant assistant daemonize webappwaiter = do transferqueue <- newTransferQueue transferslots <- newTransferSlots scanremotes <- newScanRemoteMap - mapM_ startthread + mapM_ (startthread dstatus) [ watch $ commitThread st changechan commitchan transferqueue dstatus #ifdef WITH_WEBAPP , assist $ webAppThread (Just st) dstatus scanremotes transferqueue transferslots Nothing webappwaiter @@ -177,12 +180,14 @@ startAssistant assistant daemonize webappwaiter = do , assist $ sanityCheckerThread st dstatus transferqueue changechan , assist $ mountWatcherThread st dstatus scanremotes , assist $ netWatcherThread st dstatus scanremotes + , assist $ netWatcherFallbackThread st dstatus scanremotes , assist $ transferScannerThread st dstatus scanremotes transferqueue , watch $ watchThread st dstatus transferqueue changechan ] waitForTermination watch a = (True, a) assist a = (False, a) - startthread (watcher, a) - | watcher || assistant = void $ forkIO a + startthread dstatus (watcher, t) + | watcher || assistant = void $ forkIO $ + runNamedThread dstatus t | otherwise = noop |