<div style="font-family: Helvetica; font-size: 12px; ">Hello Martin,<div><br></div><div>In this cases the problem is usually solved as Attila Rajmund Nohl said.</div><div>Since it's the common situation I wrote a lib for that: <a href="https://github.com/RGafiyatullin/gen_wp">https://github.com/RGafiyatullin/gen_wp</a></div><div>See <a href="https://github.com/RGafiyatullin/gen_wp/blob/master/src/gen_wp_example.erl">src/gen_wp_example.erl</a> for how to use it. </div><div><br></div><div>Questions and constructive critics are welcome and appreciated.</div></div>
                <div><div><br></div>--<div>RG</div><div><br></div></div>
                 
                <p style="color: #A0A0A8;">On Wednesday, December 12, 2012 at 12:46 pm, Martin Dimitrov wrote:</p>
                <blockquote type="cite" style="border-left-style:solid;border-width:1px;margin-left:0px;padding-left:10px;">
                    <span><div><div><div>Thanks, this sounds very cool.</div><div><br></div><div>On 12/12/2012 11:42 AM, Attila Rajmund Nohl wrote:</div><blockquote type="cite"><div><div>2012/12/12 Martin Dimitrov <<a href="mailto:mrtndimitrov@gmail.com">mrtndimitrov@gmail.com</a>>:</div><blockquote type="cite"><div><div>Hi all,</div><div><br></div><div>In our application, we have a gen_server that does a time consuming</div><div>operation. The message is of type cast thus the caller process doesn't</div><div>sit and wait for the operation to finish. But while the gen_server is</div><div>busy with the cast message, it doesn't serve any other call, right?</div><div><br></div><div>So, would it be appropriate to create a process that will do the time</div><div>consuming operation and then notify the gen_server?</div></div></blockquote><div><br></div><div>The pattern I use in this case is to still use gen_server:call (if the</div><div>caller needs to be blocked), start a separate process for the</div><div>time-consuming stuff, return {noreply, ...} from the handle_call (so</div><div>the gen_server can handle other calls), then call gen_server:reply</div><div>from the started process when the time-consuming operation finished.</div><div>Of course, the applicability of this pattern depends on what you</div><div>actually do.</div></div></blockquote><div><br></div><div>_______________________________________________</div><div>erlang-questions mailing list</div><div><a href="mailto:erlang-questions@erlang.org">erlang-questions@erlang.org</a></div><div><a href="http://erlang.org/mailman/listinfo/erlang-questions">http://erlang.org/mailman/listinfo/erlang-questions</a></div></div></div></span>
                 
                 
                 
                 
                </blockquote>
                 
                <div>
                    <br>
                </div>