How to 'bypass' the receive timer
Fri Feb 8 16:33:54 CET 2002
Oh, but please use erlang:start_timer(Time, self(), Msg) instead.
The timer module is not especially efficient.
On Fri, 8 Feb 2002, Faustin Ngokse wrote:
>Thanx for your hint; that sounds promising.
>I'll go for that and I think all will work fine.
>> Date: Fri, 08 Feb 2002 15:35:09 +0100
>> From: Lennart Öhman <lennart.ohman@REDACTED>
>> X-Accept-Language: en
>> MIME-Version: 1.0
>> To: Faustin Ngokse <eedfang@REDACTED>
>> CC: erlang-questions@REDACTED
>> Subject: Re: How to 'bypass' the receive timer
>> Content-Transfer-Encoding: 7bit
>> 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
>> > 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
>> > waiting undefinetely.
>> > It often happens that the messages destinated to the 'external' receive
>> > 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