gen_server partial replies

Sean Hinde sean.hinde@REDACTED
Mon Nov 24 12:29:33 CET 2003


On Monday, November 24, 2003, at 10:12  am, Vlad Dumitrescu wrote:

>> fredag 21 november 2003 17:29 skrev Bengt Kleberg:
>>> why do you want to do a partial reply? if it is to free up the server
>>> for other call's, then you could
>>> 1 spawn a new process
>>> 2 return {noreply, State};
>>> 3 use gen_server:reply(Pid, Reply), from the spawned process, when 
>>> ready
>>> to do so
>
> What I had in mind was a way to handle requests that take a lot of 
> time and
> return a lot of data. If I want or need to display some progress 
> reports, or to
> be able to handle a crash before all data is returned (so that it's not
> recomputed), then it would be nice with a way to split the results in 
> chunks.

This seems to be getting some way from what might be accomplished by a 
synchronous call - the calling process would need to use a darned 
clever implementation of gen_server:call to handle all of the out of 
band signals as well as the bits of answer. It does sound very like an 
implementation of handle_cast :-)

Sean




More information about the erlang-questions mailing list