[erlang-questions] asynchronous api patterns for returning partial results ?

Barco You barcojie@REDACTED
Tue Oct 11 16:51:03 CEST 2011


What do you mean by partial results? I think it depends on what your
callback handle_cast do, what kinds of partial results it will rerun.

Best regards,
Barco
On Oct 11, 2011 6:22 PM, "mabrek" <mabrek@REDACTED> wrote:

> Hello.
>
> Are there good examples of asynchronous api in Erlang for returning
> partial results?
> Sometimes I need to return more than a single result from a gen_server.
> gen_server:call with gen_server:reply isn't suitable for this because
> gen_server:reply can be called only once per gen_server:call.
>
> Desired behaviour can be emulated with:
>
> Ref = make_ref(),
> gen_server:cast(ServerName, {self(), Ref, Request}),
> receive_results(Ref).
>
> receive_results(Ref) ->
>    receive
>        {Ref, done} ->
>            ok;
>        {Ref, PartialResult} ->
>            do_something_with(PartialResults),
>            receive_results(Ref)
>    end.
>
> Is it a good way to receive several results from another process?
>
> Regards,
> Anton Lebedevich.
> _______________________________________________
> 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/20111011/2a8e5deb/attachment.htm>


More information about the erlang-questions mailing list