Queue not getting cleared while using Multiprocessing in Python
问题 I am having 1 queue which is accessed by 2 multiprocessing functions. Both these processes and consuming the same item in the queue and then clearing it. I want each one to take one unique value only. What am I doing wrong? import time import queue import multiprocessing import threading q = queue.Queue(maxsize=0) run_1 = 1 run_2 = 1 def multi_one(): while run_1 == 1: item = q.get() q.task_done() time.sleep(2) print(item) def multi_two(): while run_2 == 1: item = q.get() q.task_done() time