[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[MiNT] Pmsg()
Hi all!
I have decided to use Pmsg() for my problem which I described a
few days ago. I do this:
prg1: Pexec(prg2), Pmsg(0,0xFFFFxxxx,msg)
(xxxx is my own pid, msg jjust a pointer to my message)
prg2: Pmsg(2,0xFFFFxxxx,msg)
(xxxx is the pid of prg1)
Ideally this leads to the following behaviour:
prg1 starts prg2 (Pexec) and then sleeps, until it receives a message
(Pmsg(0)). Now prg2 writes a "mail" to prg1 (Pmsg(2)), thus waking
prg1 up. Since I used mode 2, prg2 is now asleep until it receives a
"mail" again.
And most of the time this works perfectly well. But the problem is,
sometimes I do get a deadlock!!!
I do have the feeling that this deadlock occurs when prg2 writes a
message, BEFORE prg1 is ready to read one. In my example, when the
Pmsg(2) of prg2 is executed BEFORE the Pmsg(0) of prg1.
Is it intended, that I really get a deadlock in this case? Aren't the
messages buffered? How can I avoid this deadlock? Or is there anything
else that could cause the deadlock? How do I make sure that prg1 is
ready to read BEFORE prg2 is writing a mail? Can I make this sure??
And what happens to messages, when I kill my process(es)? Do the
messages get deleted, too?
Cheers, Ingo =;->