TLDR: Would a blocking get be unblocked by a queue that would be terminated in some way?
Okay, so I know that the thread will hang if the queue (
multiprocessing.Queue) remains empty forever while trying to fetch something from it with a blocking get.
But suppose now that in another thread or process, I close the queue with queue.close(), call queue.cancel_join_thread(), and then also queue.join_thread().
With the blocking “get” raise an exception or something upon trying to kill the queue like that?
Yes, an exception is raised if the queue is closed.
From the latest documentation:
Under Queue.get() the following statement occurs:
“Changed in version 3.8: If the queue is closed, ValueError is raised instead of OSError.”