Ah, I had it for the other order, i.e. clauses first and message queue last, my bad.<br><br>The following question would then be, why are there ever issues with one process spamming the message queue making another process' messages not appear? Matej's problem should not exist then, or am I missing something here? Logically the receive statement should catch C2's messages at exactly the ratio they are sent?
<br><br>Cheers!<br>Adam<br><br><div class="gmail_quote">On Nov 19, 2007 11:10 AM, Paulo Sérgio Almeida <<a href="mailto:psa@di.uminho.pt">psa@di.uminho.pt</a>> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Hi,<br><div class="Ih2E3d"><br>Adam Lindberg wrote:<br>> A basic check to do is to look at your receive statement.<br>><br>> If it for example looks like this:<br>><br>> receive<br>>     {c1, Msg} -><br>
>         do_c1_stuff();<br>>     {c2, Msg} -><br>>         do_c2_stuff()<br>> end<br>><br>> In this case if there are always some messages from C1 in the message<br>> queue they will be picked first, regardless of the order. This is called
<br><br></div>This is not true. Messages are looked at in arrival order, and for each<br>message the guards are matched in program order. If the only messages in<br>the mailbox are either {c1, Msg} or {c2, Msg} the above behaves the same
<br>as the code below.<br><div class="Ih2E3d"><br>> selective receive. If you want to take the messages as they come you<br>> should do something like this:<br>><br>> receive<br>>     {Sender, Msg} -><br>
>         case Sender of<br>>             c1 -><br>>                 do_c1_stuff();<br>>             c2 -><br>>                 do_c2_stuff()<br>>         end<br>> end<br>><br>> This way you will always pick a message, the first one to be in queue
<br>> (which matches pattern {A, B} of course) and _then_ look at the sender.<br><br></div>Regards,<br><font color="#888888">/psa<br></font></blockquote></div><br>