REF use when luke

This commit is contained in:
Nathan Dwarshuis 2020-03-25 16:34:38 -04:00
parent 0ba68a457b
commit e8cf056301
1 changed files with 4 additions and 6 deletions

View File

@ -97,9 +97,7 @@ waitAndKill tag pid = waitUntilExit pidDir
withUniquePid :: WatchedPIDs -> Pid -> IO () -> IO ()
withUniquePid curPIDs pid f = do
pids <- readMVar curPIDs
if pid `elem` pids
then return ()
else do
unless (pid `elem` pids) $ do
modifyMVar_ curPIDs (return . (pid:))
f
modifyMVar_ curPIDs (return . filter (/=pid))