Archived
1
0
Fork 0

Implemented the clean killing of plugins' threads.

This commit is contained in:
Julien Dessaux 2010-05-29 00:55:14 +02:00
parent c506c58e92
commit daea135424
6 changed files with 70 additions and 33 deletions

View file

@ -31,9 +31,11 @@ hsbot config = do
, botResumeData = mvar }
putStrLn "[Hsbot] Entering main loop... "
(status, botState') <- runLoop botState
putStrLn "[Hsbot] Killing active plugins... "
resumeData <- takeMVar mvar
evalStateT (mapM_ killPlugin $ M.keys resumeData) botState'
if status == BotReboot
then resumeHsbot botState' resumeData
then resumeHsbot resumeData
else return ()
where
runLoop :: BotState -> IO (BotStatus, BotState)
@ -43,8 +45,8 @@ hsbot config = do
BotContinue -> runLoop botState'
_ -> return (status, botState')
resumeHsbot :: BotState -> BotResumeData -> IO ()
resumeHsbot botState resumeData = do
resumeHsbot :: BotResumeData -> IO ()
resumeHsbot resumeData = do
print resumeData
-- | Run the bot main loop