Requeuing a message in receive construct

Richard Carlsson richardc@REDACTED
Sun Apr 23 21:21:35 CEST 2006

Jérémie Lumbroso wrote:
> 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?

There's no way to push back a message. As you say, you can send it
to self(), but that places it at the end of the queue.

Perhaps, if you explained more exactly what it is you want to do,
someone might be able to help. In what way do you want to "delay
messages"? What is the situation?


More information about the erlang-questions mailing list