A possibly vain attempt to avoid a race condition on worker thread shutdown.