How to 'bypass' the receive timer

Lennart Öhman lennart.ohman@REDACTED
Fri Feb 8 15:35:09 CET 2002

Hi Faustin,

it sounds to me that what you want to do is to start a set a timer
in the timer process for each handled message which will be followed by
a second message. Look in stdlib for timer.
timer:send_after(Time,MessageIWillGetBack) for instance. If you get the
expected message you either cancel the time-out or program in a way that
you can ignore it when it eventually arrives.

I guess the reason for going to a special receive statment (having the
time-out) is that you need to handled the second message in a context
dictated by the previous.

You will achieve this by letting the tail-recursive function having the
main receive statment have an argument where such relevant parameters
for that context can be kept.


Faustin Ngokse wrote:
> Hello erlang friends,
> This is my first contribution on this mailing list, I guess I am at the right
> place.
> I have an erlang process working as server and receiving a lot of messages.
> Some messages trigger further "receive" with a timer to prevent the process from
> waiting undefinetely.
> It often happens that the messages destinated to the 'external' receive can't be
> delivered because the timer for the 'internal' receiver is not yet over.
> This make my server process very very slow.
> Is there a possibility to influence the message so that messages for the
> 'external' receive can be delivered while the 'internal' receive is still
> waiting?
> Do anybody have another idea how to solve this problem?
> Thanx in advance
> Faustin

Lennart Ohman                   phone   : +46-8-587 623 27
Sjoland & Thyselius Telecom AB  cellular: +46-70-552 6735
Sehlstedtsgatan 6               fax     : +46-8-667 8230
SE-115 28 STOCKHOLM, SWEDEN     email   : lennart.ohman@REDACTED

More information about the erlang-questions mailing list