[erlang-questions] Re: Local node worker process pool
Ciprian Dorin, Craciun
Tue Jan 12 14:37:36 CET 2010
On Tue, Jan 12, 2010 at 3:28 PM, Steve Davis
> Hi Ciprian,
> Take a closer look at gen_server:cast() which is the asynchronous
> "call" to a gen_server.
Indeed the `gen_server:cast` is one such a solution, but this
means that the module you are using was designed to use cast and not
call for such updates.
(Also it doesn't solve the other (more generic) problem (to which
my initial request was only a particularization), that is asynchronous
call to a time-consuming function.)
And an even more complicated scenario: I want reliable
asynchronous call to a gen_server, that is I want to be able to use
`gen_server:call(Server,Request,Timeout)` and receive back either the
reply or the timeout answer.
Of course this could be achieved by using a plain send (thus
hard-coding the gen_server protocol), and then set a timer to callback
my gen_server in case of timeout, and in the mean-time if I receive
the response I should destroy the timer... But you see the
complications, and I wouldn't like to implement them over and over
again, thus I thought that a simple "local worker process pool" would
solve this and other similar problems.
P.S.: In the end I'll think I'll just make two interfaces for my
statistics collection server: one based on `call`, and the other based
More information about the erlang-questions