Requeuing a message in receive construct

Jérémie Lumbroso <>
Fri Apr 21 19:34:14 CEST 2006


Hello,

I'm use the very practical receive ... end. construct in Erlang to handle
messages.

Everything is fine except that I would like an elegant way to delay
messages. I thought of keeping track of the bytes sent, and then decreasing
that amount every second. But I am unable to do this elegantly. How do you
periodly decrease that variable while still maintaining that receive ...
end. construct (or do you suggest starting a process which's only task is to
decrease X by a given amount every second?).

Anyway, at one point---and I'm not sure I'm going to end up using it, but it
might become useful---I was wondering whether or not it's possible to
requeue a message? Obviously, sending to self() would work, but then it
would be at the bottom of a queue, and when order matters, that could be a
problem. Is there a way to catch a message, and then "uncatch" it? Or that
simply not idiomatic?

Regards,

Jérémie
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20060421/3d1be941/attachment.html>


More information about the erlang-questions mailing list