It does from a fresh start of FreeSWITCH. I've noticed, although not really confirmed, a race condition between the unload and reload of managed code. It seems that threads started in the newly submodule are terminated along with the threads for the old, unloading submodule. Is that what you are seeing as well?<div>
<br></div><div><div class="gmail_quote">On Wed, Sep 9, 2009 at 2:38 PM, Jeff Lenk <span dir="ltr"><<a href="mailto:jlenk@frontiernet.net">jlenk@frontiernet.net</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<br>
Yeah I noticed that but the thread was still terminating after a few seconds<br>
anyway for me. Does it stay running for you?<br>
<div><div></div><div class="h5"><br>
<br>
Josh Rivers-2 wrote:<br>
><br>
> A new discovery: public bool Load()<br>
> {<br>
> ThreadPool.QueueUserWorkItem((o) =><br>
> {<br>
> Log.WriteLine(LogLevel.Notice, "Thread Starting. ");<br>
> EventConsumer con = new EventConsumer("all", "");<br>
> while (true)<br>
> {<br>
> Event ev = con.pop(0);<br>
> if (ev == null) continue;<br>
> Log.WriteLine(LogLevel.Notice, "Event: " +<br>
> ev.serialized_string);<br>
> }<br>
> });<br>
> return true;<br>
> }<br>
> Does not crash. (Adding the null check prevents crash.) The backgrounded<br>
> loop runs fine. Looks like the event object goes straight to pinvokes, so<br>
> a<br>
> null result just crashes?<br>
><br>
> I like the idea of a 'startup-script' for mod_managed. It would also be<br>
> excellent if there was an event or message informing the background code<br>
> to<br>
> terminate nicely when the module reloads.<br>
><br>
> --Josh<br>
><br>
> On Wed, Sep 9, 2009 at 12:57 PM, Jeff Lenk <<a href="mailto:jlenk@frontiernet.net">jlenk@frontiernet.net</a>> wrote:<br>
><br>
>><br>
>> I think the problem here is that the loader only keeps this method in<br>
>> scope<br>
>> until completion then it drops the remoted connection. Therefore you<br>
>> should<br>
>> not use threads in this method. Michael please correct me if I am wrong<br>
>> here.<br>
>><br>
>> As an example of the failure simply just put a Sleep(10000) call in the<br>
>> thread and you will see the failure.<br>
>><br>
>> As Michael said this method was only designed to allow the option to opt<br>
>> out<br>
>> of being loaded.<br>
>><br>
>> In order to support this perhaps a configuration flag simular to the lua<br>
>> "startup-script" should be added.<br>
>><br>
>><br>
>><br>
>> Here is the error I get with the loop I mentioned. -Josh<br>
>> [image: Capture.PNG]<br>
>><br>
>> On Tue, Sep 8, 2009 at 5:05 AM, Michael Giagnocavo<br>
>> <<a href="mailto:mgg@giagnocavo.net">mgg@giagnocavo.net</a>>wrote:<br>
>><br>
>> > Hi,<br>
>> ><br>
>> ><br>
>> ><br>
>> > Can you please elaborate on the crash you receive when<br>
>> you<br>
>> > queue a thread during load?<br>
>> ><br>
>> ><br>
>> ><br>
>> > Thanks,<br>
>> ><br>
>> > Michael<br>
>> ><br>
>> ><br>
>><br>
>> --<br>
>> View this message in context:<br>
>> <a href="http://n2.nabble.com/Subscribing-to-events-in-managed-C-NET-tp3573619p3613195.html" target="_blank">http://n2.nabble.com/Subscribing-to-events-in-managed-C-NET-tp3573619p3613195.html</a><br>
>> Sent from the freeswitch-users mailing list archive at Nabble.com.<br>
>><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>
><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>
><br>
<br>
</div></div><font color="#888888">--<br>
View this message in context: <a href="http://n2.nabble.com/Subscribing-to-events-in-managed-C-NET-tp3573619p3614845.html" target="_blank">http://n2.nabble.com/Subscribing-to-events-in-managed-C-NET-tp3573619p3614845.html</a><br>
</font><div><div></div><div class="h5">Sent from the freeswitch-users mailing list archive at Nabble.com.<br>
<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>
</div></div></blockquote></div><br></div>