I am currently trying to make my application. I am writing C code and using PVM library. I will try to shorten what is the app supposed to do:
Master process spawns eg. 5 slave processes, which are communicating between each other and master. Slave process is supposed to do two parallel actions: execute own procedures and the second thing - be a listener to messages coming from other slaves.
Here is a small part of code, which is working randomly:
int main()
{
init();
if(fork() == 0)
{
while(1)
{
//perform listener actions
}
}
else
{
while(1)
{
//perform some procedures
}
}
}
When I put some SEND_MESSAGE actions to MASTER process inside both of these while loops, it performs very strange to me. For example, without those while loops, if I send 5 messages form both of these whiles (together 10 :-)), the master process receives eg. 5 from first loop and 1 message from second. If we WAIT(NULL) in the parent process, it executes well (of course there is no while(1) loop then). What might be the problem? Master process keeps waiting for incoming messages, but never receives them.
Thank You for help! Regards, Remy