gen_server communication conventions

Luke Gorrie luke@REDACTED
Mon Jun 21 15:48:29 CEST 1999

Hi again all,

I've got another question regarding gen_server.  This time, my server
doesn't seem to quite fit the gen_server mould.  I want to make
synchronous invocations from clients, but I'd like the server to be
able to defer responding beyond the scope of the call resulting from
gen_server:call().  This seems simple enough to implement: I have the
client make a 'cast' to the server which includes the client pid; the 
client blocks on a receive for a response; the server later, based on
some event or other, sends the response directly to the client
process; the client returns with the result.

My question is: Is that a "good" way, or can it and should it be
managed instead through a standard behaviour somehow?  I can't really
see how it could be mapped onto straight gen_server calls.  I'm not
familiar with what magic goes on inside gen_server, and I just want to 
make sure I wouldn't be disabling some of the features associated with 
the gen_server behaviour by doing this.


More information about the erlang-questions mailing list