It depends on your design and usage scenarios. queue.join will block until all messages in the queue are retrieved and task_done is called before returning. Usually used to wait for all tasks to be processed and then exit the process. Empty will return immediately. When checking with your while loop, if the queue is empty, the thread will continue to loop endlessly. Waiting in a loop consumes a lot of CPU.
It depends on your design and usage scenarios.
queue.join will block until all messages in the queue are retrieved and task_done is called before returning. Usually used to wait for all tasks to be processed and then exit the process.
Empty will return immediately. When checking with your while loop, if the queue is empty, the thread will continue to loop endlessly. Waiting in a loop consumes a lot of CPU.