I have an multiprocess queue which is shared between multiple running process. At some point (while all the processes are not using it for reading or writing), I need to empty that queue.
The only working way I could find is
total_q_item = frames_queue.qsize()
for i in range(total_q_item):
frames_queue.get()
However, it is really slow.
Other option I found online is to replace the queue with new empty queue object. However, this does not work since the queue is shared by multiple processes.
What other fast options are there?