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

Gleb Peregud gleber.p@REDACTED
Fri Jan 4 21:24:26 CET 2013


Please note that if you have two identical messages you won't be able
to fetch a second message from the queue - receive will always get the
first one.

On Fri, Jan 4, 2013 at 9:21 PM, Aggelos Giantsios <aggelgian@REDACTED> wrote:
> The selective receive with a bound Msg worked like a charm.
> Thanks for the help!!
>
> Aggelos
>
>
> On Fri, Jan 4, 2013 at 10:03 PM, Tony Rogvall <tony@REDACTED> wrote:
>>
>> Yes, of course :-)
>>
>> Not sure what I was drinking...
>>
>> /Tony
>>
>> On 4 jan 2013, at 20:55, Erik Søe Sørensen <eriksoe@REDACTED> wrote:
>>
>> [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 <aggelgian@REDACTED>
>>>
>>> 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
>>> erlang-questions@REDACTED
>>> http://erlang.org/mailman/listinfo/erlang-questions
>>>
>>
>>
>> _______________________________________________
>> erlang-questions mailing list
>> erlang-questions@REDACTED
>> http://erlang.org/mailman/listinfo/erlang-questions
>>
>>
>> "Installing applications can lead to corruption over time. Applications
>> gradually write over each other's libraries, partial upgrades occur, user
>> and system errors happen, and minute changes may be unnoticeable and
>> difficult to fix"
>>
>>
>>
>>
>> _______________________________________________
>> erlang-questions mailing list
>> erlang-questions@REDACTED
>> http://erlang.org/mailman/listinfo/erlang-questions
>>
>
>
> _______________________________________________
> erlang-questions mailing list
> erlang-questions@REDACTED
> http://erlang.org/mailman/listinfo/erlang-questions
>



More information about the erlang-questions mailing list