destroyWorkerCache :: IO ()
destroyWorkerCache =
    do wc <- workerCache
       killAllWorkers wc
       where killAllWorkers wc =
                 do targ <-
                        atomically $ do t <- readTVar $ hw_next_lru $ wc_root wc
                                        if hw_is_root t
                                         then return Nothing
                                         else do privatiseWorker wc t
                                                 return $ Just t
                    case targ of
                      Nothing -> return ()
                      Just t -> do reallyKillHistoryWorker t
                                   killAllWorkers wc
destroyWorkerCache :: IO ()
destroyWorkerCache =
    do wc <- workerCache
       killAllWorkers wc
       where killAllWorkers wc =
                 do targ <-
                        atomically $ do t <- readTVar $ hw_next_lru $ wc_root wc
                                        if hw_is_root t
                                         then return Nothing
                                         else do privatiseWorker wc t
                                                 return $ Just t
                    case targ of
                      Nothing -> return ()
                      Just t -> do reallyKillHistoryWorker t
                                   killAllWorkers wc
destroyWorkerCache =
    do wc <- workerCache
       killAllWorkers wc
       where killAllWorkers wc =
                 do targ <-
                        atomically $ do t <- readTVar $ hw_next_lru $ wc_root wc
                                        if hw_is_root t
                                         then return Nothing
                                         else do privatiseWorker wc t
                                                 return $ Just t
                    case targ of
                      Nothing -> return ()
                      Just t -> do reallyKillHistoryWorker t
                                   killAllWorkers wc