summaryrefslogtreecommitdiff
path: root/Assistant.hs
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2012-07-27 15:33:24 -0400
committerGravatar Joey Hess <joey@kitenet.net>2012-07-27 15:33:24 -0400
commit02ec8ea01254637facb30f77b7cb74be3b735c0d (patch)
tree3ba054919ab49a457c287163d5b41f8f4e3e5678 /Assistant.hs
parentbc5b1516175f143f42bda2d12f512768d2df7c9e (diff)
much better webapp startup of the assistant
This avoids forking another process, avoids polling, fixes a race, and avoids a rare forkProcess thread hang that I saw once time when starting the webapp.
Diffstat (limited to 'Assistant.hs')
-rw-r--r--Assistant.hs9
1 files changed, 4 insertions, 5 deletions
diff --git a/Assistant.hs b/Assistant.hs
index 6b155a4a6..ca428988f 100644
--- a/Assistant.hs
+++ b/Assistant.hs
@@ -124,8 +124,8 @@ import Utility.ThreadScheduler
import Control.Concurrent
-startDaemon :: Bool -> Bool -> Annex ()
-startDaemon assistant foreground
+startDaemon :: Bool -> Bool -> Maybe (IO ()) -> Annex ()
+startDaemon assistant foreground webappwaiter
| foreground = do
showStart (if assistant then "assistant" else "watch") "."
go id
@@ -157,12 +157,11 @@ startDaemon assistant foreground
, mountWatcherThread st dstatus scanremotes
, transferScannerThread st scanremotes transferqueue
#ifdef WITH_WEBAPP
- , webAppThread st dstatus transferqueue
+ , webAppThread st dstatus transferqueue webappwaiter
#endif
, watchThread st dstatus transferqueue changechan
]
- debug "assistant"
- ["all git-annex assistant threads started"]
+ debug "Assistant" ["all threads started"]
waitForTermination
stopDaemon :: Annex ()