Communicating between threads
suggest changeThere are multiple threads in your code and you need to safely communicate between them.
You can use a Queue from the queue library.
Creating producer and consumer threads with a shared queue
q = Queue()
t1 = Thread(target=consumer, args=(q,))
t2 = Thread(target=producer, args=(q,))
t1.start()
t2.start()
Found a mistake? Have a question or improvement idea?
Let me know.
Table Of Contents