thread-safe priority queue.