[erlang-questions] perform a function on a fixed time interval

Joseph Wayne Norton norton@REDACTED
Tue Aug 24 13:20:02 CEST 2010


One technique is to flush the erlang process's mailbox after returning  
 from compute().

You can find an example inside this erlang module:

   http://github.com/norton/gdss/blob/master/src/brick_clientmon.erl

Look for flush_mailbox_extra_check_status().  The flush is needed because  
net_adm:ping/1 can take several seconds if the target host is offline.

thanks,

On Tue, 24 Aug 2010 20:06:12 +0900, Roberto Ostinelli  
<roberto@REDACTED> wrote:

> 2010/8/24 Mazen Harake <mazen.harake@REDACTED>:
>>  Be cautious,
>>
>> Using send messages in an interval is dangerous if compute() can take  
>> more
>> then the interval. It can build up message queues on a congested system;
>> especially if what compute() does has side effects.
>>
>> Just a word of advise.
>>
>
> you are absolutely right, and i'm aware of the issue.
>
> it's a game engine which needs to detect collision between particles,
> and thus it needs to periodically compute the position of all elements
> and see if these collide or not.
>
> what would you recommend to ensure avoiding this issue?
>
> ________________________________________________________________
> erlang-questions (at) erlang.org mailing list.
> See http://www.erlang.org/faq.html
> To unsubscribe; mailto:erlang-questions-unsubscribe@REDACTED
>


-- 
norton@REDACTED


More information about the erlang-questions mailing list