I just want to know how to clear a multiprocessing queue in python like a normal python queue. For instance:
from multiprocessing import Queue # multiprocessing queue
from Queue import Queue # normal queue
multi_q = Queue()
normal_q = Queue()
multi_q.clear() # or multi_q.queue.clear()
'Queue' object has no attribute 'clear'
normal_q.queue.clear() # This is ok
解决方案
There is no direct way of clearing a multiprocessing.Queue.
I believe the closest you have is close(), but that simply states that no more data will be pushed to that queue, and will close it when all data has been flushed to the pipe.