[erlang-questions] Manually remove a message from Process Mailbox

Erik Søe Sørensen <>
Fri Jan 4 20:55:08 CET 2013


[forgot to write the list]

That would be
  receive TheMsg when TheMsg=:=Msg -> ok end
(or shorter but perhaps less clear:
  receive Msg -> ok end
where Msg is already bound)
assuming of course that you won't be trying to remove the non-first copy of
a specific message - but given that you say you're trying to emulate the
receive expression, and that doesn't allow it, then the above should be
what you want.

2013/1/4 Aggelos Giantsios <>

> Happy New Year to everyone!
>
> I am trying to simulate the 'receive' expression behaviour.
> I access the process message queue with erlang:process_info(self(),
> messages).
> Assuming I have selected a message Msg which is at position k in the
> message list and have safely stored it in a variable,
> is there a way to manually remove Msg from the process message queue?
>
> Thanks,
> Aggelos
>
>
> _______________________________________________
> erlang-questions mailing list
> 
> http://erlang.org/mailman/listinfo/erlang-questions
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20130104/3f21a6c9/attachment.html>


More information about the erlang-questions mailing list