How to clear a multiprocessing queue in python

后端 未结 3 1503
被撕碎了的回忆
被撕碎了的回忆 2021-01-03 21:32

I just want to know how to clear a multiprocessing queue in python like a normal python queue. For instance:

from multiprocessing import Queue  # multiproces         


        
3条回答
  •  难免孤独
    2021-01-03 21:42

    So, I take look at Queue class, and you may to try this code:

    while not some_queue.empty():
        some_queue.get()  # as docs say: Remove and return an item from the queue.
    

提交回复
热议问题