privatiseWorker :: WorkerCache -> HistoryWorker -> STM Bool
privatiseWorker wc hw =
    do {- Remove from the list -}
       d <- readTVar $ hw_dead hw
       writeTVar (hw_dead hw) True
       when (not d) $
            do p <- readTVar $ hw_prev_lru hw
               n <- readTVar $ hw_next_lru hw
               writeTVar (hw_next_lru p) n
               writeTVar (hw_prev_lru n) p
               writeTVar (hw_prev_lru hw) hw
               writeTVar (hw_next_lru hw) hw
               nw <- readTVar $ wc_nr_workers wc
               writeTVar (wc_nr_workers wc) (nw - 1)
       return d
privatiseWorker :: WorkerCache -> HistoryWorker -> STM Bool
privatiseWorker wc hw =
    do {- Remove from the list -}
       d <- readTVar $ hw_dead hw
       writeTVar (hw_dead hw) True
       when (not d) $
            do p <- readTVar $ hw_prev_lru hw
               n <- readTVar $ hw_next_lru hw
               writeTVar (hw_next_lru p) n
               writeTVar (hw_prev_lru n) p
               writeTVar (hw_prev_lru hw) hw
               writeTVar (hw_next_lru hw) hw
               nw <- readTVar $ wc_nr_workers wc
               writeTVar (wc_nr_workers wc) (nw - 1)
       return d
privatiseWorker wc hw =
    do {- Remove from the list -}
       d <- readTVar $ hw_dead hw
       writeTVar (hw_dead hw) True
       when (not d) $
            do p <- readTVar $ hw_prev_lru hw
               n <- readTVar $ hw_next_lru hw
               writeTVar (hw_next_lru p) n
               writeTVar (hw_prev_lru n) p
               writeTVar (hw_prev_lru hw) hw
               writeTVar (hw_next_lru hw) hw
               nw <- readTVar $ wc_nr_workers wc
               writeTVar (wc_nr_workers wc) (nw - 1)
       return d