<div dir="ltr">I need some help finding a pattern/solution to a problem that is proving more difficult then it should, it seems.<div><br></div><div>I have a gen_server module that needs to take an asynchronous request/response operation and expose it as a synchronous operation. Typically I would use receive to block and have the asynchronous operation issue a message to unblock it but that won't work (i believe) with a gen_server since it loops over receive and forwards them to calls to handle_info. The code below demonstrates the core of the matter of what i'm talking about. I'm not sure what the solution would be to achieve this functionality while using the gen_server behaviour.</div><div><br></div><div><br></div><div><br></div><div>handle_call({request, Data#data{uid=UID}}, _From, State) -><br></div><div>    make_asycnc_req(Data),</div><div>    receive<br></div><div>        {UID, Response} -> {reply, Response, State}</div><div>    end.</div><div><br></div><div>handle_info({response, Response#response{uid=UID}}, State) -></div><div>    self() ! {UID, Response},</div><div>    {noreply, State}.</div><div><br></div><div>Thanks,</div><div><br></div><div>-- Chris</div></div>