I have two multiprocessing threads, one adds items to a queue, the other needs to iterate through the current queue. How do I do that iteration? Or alternatively, how do I convert the current queue to a list to iterate?
Some pseudocode:
import multiprocessing as mp
thequeue = mp.Queue()
def func1():
global thequeue
while True:
item = readstream()
if item not None:
thequeue.put(item)
def func2():
while True:
for item in thequeue: # This only works for Lists, how to do this for queues?
if item == "hi":
print(item)
main():
mp.Process(target=func1).start()
mp.Process(target=func2).start()