[erlang-questions] Fwd: Re: Generic server and selective receives
Robert Virding
rvirding@REDACTED
Mon Feb 17 13:58:34 CET 2014
This section in the erlang documentation gives some explanation and
examples:
http://www.erlang.org/doc/design_principles/spec_proc.html
You do have to careful and follow the rules, but it is surprisingly simple.
Note that this does not give you a behaviour "just" a process which fits
into the OTP environment, for example it will work as it should in
supervision trees.
Robert
On 17 February 2014 10:38, <ludovic@REDACTED> wrote:
>
>
> Hi,
>
> Thank you for yours answers. With timer:no_diff/ is quite easy to handle
> "selective timeout" in a gen server so okay it could be a decent solution.
> The only problem is to have code to handle it in every callback that reset
> the timeout, this is okay. But I would not use a gen_fsm, because if you
> look at my first implementation, when there's no client the messages that
> are NOT {set_client, ...} are not discarded, they are stacked in the
> process mailbox for later use and this is expected.
>
>
>
> Le 2014-02-17 10:11, Anthony Ramine a écrit :
>
> You don’t have to reimplement ‘gen’ to implement a sys process, no.
>>
>
>
> As i may need to implement several processes with this kind of "client
> presence enforcement", implementing a sys process could be worth trying.
> (Plus i'll learn a lot). Have you got any link to a good tutorial/guide ?
>
> Thanks
>
> -- lud
>
> _______________________________________________
> erlang-questions mailing list
> erlang-questions@REDACTED
> http://erlang.org/mailman/listinfo/erlang-questions
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20140217/1a9a30c4/attachment.htm>
More information about the erlang-questions
mailing list