I have two types of processes.
I want process B to wait for a message from process A. Once A sends the message, process B should process the message and wait again.
Also, I will have multiple instances of process A and process B. So, all the B processes should send the messages to all A processes.
I was looking at something like signals, but with a string attached to it.
What is the best way to do this?
I know I can create a pipe and keep reading the pipe in a while, but it seems inneficient. Also, won’t it get removed from the pipe once read?
Note: None of the processes are subprocesses of each other.
This is what I ended up doing at last…
Made the producer process into a
moduleand imported it into the consumer. Thus, both the processes can share variables.Producer threads will keep producing and consumer threads will keep consuming. And I am using
conditionto synchronize the data,threading.Condition().Each Producer thread:
conditionnotifyAll()conditionEach Consumer thread:
conditionconditioncondition…This is just a high level view. In my case, I have different types of producer threads each producing different data and meant for a particular group of consumers. So, I have a
list of condition.Reference on condition