I am new to amazing world of python, was developing a test system consist of continuous sense and test run. i have three or more while loops of which one is producer and rest two are consumers. did not understand multiprocessing very well, here are a sample code, first loop will create a data and second loop will get the data, how to impliment this in a infinity while loop, i will stop loop in the main program but asking your kind help to understand data exchange between while loops
from multiprocessing import Process,Queue
from time import sleep
q=Queue()
cnt=0
def send():
global cnt
while True:
sleep(1)
cnt=cnt+1
q.put(cnt,False)
print ("data Send:",cnt)
def rcv():
while True:
sleep(1)
newdata=q.get(cnt, False)
print ("data Received",newdata)
if __name__=='__main__':
p1=Process(target=send)
p2=Process(target=rcv)
p1.start()
p2.start()
p1.join()
p2.join()