[erlang-questions] Noob gen_server questions

Lev Walkin vlm@REDACTED
Sat Jul 12 14:25:00 CEST 2008


Ashok P. Nadkarni wrote:
> Just started learning Erlang and OTP and had a couple of questions about 
> gen_server behaviours.
> 
> I want to have a gen_server process that is actually a dispatcher that 
> passes on the call to another process that does the actual work and 
> generates the result. So mymodule:handle_call will return {noreply, 
> NewState} and the worker process will at some later point send the 
> result back to the client. The question is - how can the latter be 
> accomplished? I presume the gen_server:reply() cannot be used from a 
> different process.

Presumption's wrong. It can be used from a different process.

> Is there a better way to accomplish my goal - not to block a gen_server 
> from accepting new requests when a particular request can potentially 
> take a long time.

This is the best way. That is, to forward the From to a different
process.

-- 
Lev Walkin
vlm@REDACTED



More information about the erlang-questions mailing list