Fix thread access to queue.