fix kqueue build
This commit is contained in:
parent
453b185c85
commit
b2e359a15d
2 changed files with 15 additions and 7 deletions
|
@ -236,9 +236,14 @@ updateAlertMap dstatus a = notifyAlert dstatus `after` modifyDaemonStatus_ dstat
|
||||||
- The alert is left visible afterwards, as filler.
|
- The alert is left visible afterwards, as filler.
|
||||||
- Old filler is pruned, to prevent the map growing too large. -}
|
- Old filler is pruned, to prevent the map growing too large. -}
|
||||||
alertWhile :: DaemonStatusHandle -> Alert -> IO Bool -> IO Bool
|
alertWhile :: DaemonStatusHandle -> Alert -> IO Bool -> IO Bool
|
||||||
alertWhile dstatus alert a = do
|
alertWhile dstatus alert a = alertWhile' dstatus alert $ do
|
||||||
|
r <- a
|
||||||
|
return $ (r, r)
|
||||||
|
|
||||||
|
alertWhile' :: DaemonStatusHandle -> Alert -> IO (Bool, a) -> IO a
|
||||||
|
alertWhile' dstatus alert a = do
|
||||||
let alert' = alert { alertClass = Activity }
|
let alert' = alert { alertClass = Activity }
|
||||||
i <- addAlert dstatus alert'
|
i <- addAlert dstatus alert'
|
||||||
r <- bracket_ noop noop a
|
(ok, r) <- bracket_ noop noop a
|
||||||
updateAlertMap dstatus $ convertToFiller i r
|
updateAlertMap dstatus $ convertToFiller i ok
|
||||||
return r
|
return r
|
||||||
|
|
|
@ -72,11 +72,11 @@ watchThread st dstatus transferqueue changechan = do
|
||||||
}
|
}
|
||||||
|
|
||||||
{- Initial scartup scan. The action should return once the scan is complete. -}
|
{- Initial scartup scan. The action should return once the scan is complete. -}
|
||||||
startupScan :: ThreadState -> DaemonStatusHandle -> IO a -> IO ()
|
startupScan :: ThreadState -> DaemonStatusHandle -> IO a -> IO a
|
||||||
startupScan st dstatus scanner = do
|
startupScan st dstatus scanner = do
|
||||||
runThreadState st $ showAction "scanning"
|
runThreadState st $ showAction "scanning"
|
||||||
void $ alertWhile dstatus startupScanAlert $ do
|
r <- alertWhile' dstatus startupScanAlert $ do
|
||||||
void $ scanner
|
r <- scanner
|
||||||
|
|
||||||
-- Notice any files that were deleted before
|
-- Notice any files that were deleted before
|
||||||
-- watching was started.
|
-- watching was started.
|
||||||
|
@ -85,10 +85,13 @@ startupScan st dstatus scanner = do
|
||||||
showAction "started"
|
showAction "started"
|
||||||
|
|
||||||
modifyDaemonStatus_ dstatus $ \s -> s { scanComplete = True }
|
modifyDaemonStatus_ dstatus $ \s -> s { scanComplete = True }
|
||||||
return True
|
|
||||||
|
return (True, r)
|
||||||
|
|
||||||
void $ addAlert dstatus runningAlert
|
void $ addAlert dstatus runningAlert
|
||||||
|
|
||||||
|
return r
|
||||||
|
|
||||||
ignored :: FilePath -> Bool
|
ignored :: FilePath -> Bool
|
||||||
ignored = ig . takeFileName
|
ignored = ig . takeFileName
|
||||||
where
|
where
|
||||||
|
|
Loading…
Reference in a new issue