<div dir="ltr">Dave, there must be something else. I did as you suggested, but my module will hang during shutdown.<div>The program hangs on EventConsumer.Dispose.</div><div><a href="http://pastebin.com/58NRKSPf" target="_blank">http://pastebin.com/58NRKSPf</a><br>

</div><div><div>FreeSWITCH Version 1.5.6b+git~20130912T164754Z~d9216daedb (git d9216da 2013-09-12 16:47:54Z)</div></div><div>windows 7 64 bit</div><div><br></div><div>but</div><div>if the EventConsumer is disposed before system shutdown (for example, after consuming a certain number of events), there is no problem, event receiver thread terminates correctly and system shuts down cleanly.</div>
<div>I think i can live with that. Thanks for your help.</div><div>R</div><div><br></div><div><br></div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Sat, Sep 21, 2013 at 3:56 AM, Dave R. Kompel <span dir="ltr">&lt;<a href="mailto:drk@drkngs.net" target="_blank">drk@drkngs.net</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><u></u>

<div>
<div>To answer all your questions at once...</div>
<div> </div>
<div>put the EventConsumer inside a using() block, so it gets disposed.</div>
<div> </div>
<div>use a static boolean variable in a while loop to .pop the event consumer with a timeout, if pop returns null &quot;continue&quot; the while loop.</div>
<div> </div>
<div>Subscribe to shutdown, it sets the loop variable to false.</div>
<div> </div>
<div>API command &quot;shutdown&quot; in the same module to set the variable to false also, so you can unload your module at will w/o crashing</div>
<div> </div>
<div>This whole loop shoud be run on it&#39;s own thread started from the Load() method.</div>
<div> </div>
<div>--Dave</div><br>
<blockquote style="BORDER-LEFT:#0000ff 2px solid;PADDING-LEFT:5px;MARGIN-LEFT:5px;MARGIN-RIGHT:0px"><div class="im">
<hr>
<b>From:</b> Rafal Gwizdala [mailto:<a href="mailto:rafal.gwizdala@gmail.com" target="_blank">rafal.gwizdala@gmail.com</a>]<br><b>To:</b> FreeSWITCH Users Help [mailto:<a href="mailto:freeswitch-users@lists.freeswitch.org" target="_blank">freeswitch-users@lists.freeswitch.org</a>]<br>
</div><b>Sent:</b> Fri, 20 Sep 2013 04:08:58 -0700<br><b>Subject:</b> Re: [Freeswitch-users] mod_managed - beginner&#39;s question about an event listener module<div class="im"><br><br>
<div>(...)
<div>my source code: <a href="http://pastebin.com/bKPyKSwS" target="_blank">http://pastebin.com/bKPyKSwS</a></div>
<div><br></div></div></div></blockquote>


<div> </div>
<div> </div></div><br>_________________________________________________________________________<br>
Professional FreeSWITCH Consulting Services:<br>
<a href="mailto:consulting@freeswitch.org">consulting@freeswitch.org</a><br>
<a href="http://www.freeswitchsolutions.com" target="_blank">http://www.freeswitchsolutions.com</a><br>
<br>
FreeSWITCH-powered IP PBX: The CudaTel Communication Server<br>
<a href="http://www.cudatel.com" target="_blank">http://www.cudatel.com</a><br>
<br>
Official FreeSWITCH Sites<br>
<a href="http://www.freeswitch.org" target="_blank">http://www.freeswitch.org</a><br>
<a href="http://wiki.freeswitch.org" target="_blank">http://wiki.freeswitch.org</a><br>
<a href="http://www.cluecon.com" target="_blank">http://www.cluecon.com</a><br>
<br>
FreeSWITCH-users mailing list<br>
<a href="mailto:FreeSWITCH-users@lists.freeswitch.org">FreeSWITCH-users@lists.freeswitch.org</a><br>
<a href="http://lists.freeswitch.org/mailman/listinfo/freeswitch-users" target="_blank">http://lists.freeswitch.org/mailman/listinfo/freeswitch-users</a><br>
UNSUBSCRIBE:<a href="http://lists.freeswitch.org/mailman/options/freeswitch-users" target="_blank">http://lists.freeswitch.org/mailman/options/freeswitch-users</a><br>
<a href="http://www.freeswitch.org" target="_blank">http://www.freeswitch.org</a><br>
<br></blockquote></div><br></div>