[Freeswitch-users] Subscribing to events in managed C# / .NET

Josh Rivers josh at radianttiger.com
Wed Sep 9 15:10:43 PDT 2009


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?
On Wed, Sep 9, 2009 at 2:38 PM, Jeff Lenk <jlenk at frontiernet.net> wrote:

>
> Yeah I noticed that but the thread was still terminating after a few
> seconds
> anyway for me. Does it stay running for you?
>
>
> Josh Rivers-2 wrote:
> >
> > A new discovery:        public bool Load()
> >         {
> >             ThreadPool.QueueUserWorkItem((o) =>
> >             {
> >                 Log.WriteLine(LogLevel.Notice, "Thread Starting. ");
> >                 EventConsumer con = new EventConsumer("all", "");
> >                 while (true)
> >                 {
> >                     Event ev = con.pop(0);
> >                     if (ev == null) continue;
> >                     Log.WriteLine(LogLevel.Notice, "Event: " +
> > ev.serialized_string);
> >                 }
> >             });
> >             return true;
> >         }
> > Does not crash. (Adding the null check prevents crash.) The backgrounded
> > loop runs fine. Looks like the event object goes straight to pinvokes, so
> > a
> > null result just crashes?
> >
> > I like the idea of a 'startup-script' for mod_managed. It would also be
> > excellent if there was an event or message  informing the background code
> > to
> > terminate nicely when the module reloads.
> >
> > --Josh
> >
> > On Wed, Sep 9, 2009 at 12:57 PM, Jeff Lenk <jlenk at frontiernet.net>
> wrote:
> >
> >>
> >> I think the problem here is that the loader only keeps this method in
> >> scope
> >> until completion then it drops the remoted connection. Therefore you
> >> should
> >> not use threads in this method. Michael please correct me if I am wrong
> >> here.
> >>
> >> As an example of the failure simply just put a Sleep(10000) call in the
> >> thread and you will see the failure.
> >>
> >> As Michael said this method was only designed to allow the option to opt
> >> out
> >> of being loaded.
> >>
> >> In order to support this perhaps a configuration flag simular to the lua
> >> "startup-script" should be added.
> >>
> >>
> >>
> >> Here is the error I get with the loop I mentioned. -Josh
> >> [image: Capture.PNG]
> >>
> >> On Tue, Sep 8, 2009 at 5:05 AM, Michael Giagnocavo
> >> <mgg at giagnocavo.net>wrote:
> >>
> >> >  Hi,
> >> >
> >> >
> >> >
> >> >                 Can you please elaborate on the crash you receive when
> >> you
> >> > queue a thread during load?
> >> >
> >> >
> >> >
> >> > Thanks,
> >> >
> >> > Michael
> >> >
> >> >
> >>
> >> --
> >> View this message in context:
> >>
> http://n2.nabble.com/Subscribing-to-events-in-managed-C-NET-tp3573619p3613195.html
> >> Sent from the freeswitch-users mailing list archive at Nabble.com.
> >>
> >> _______________________________________________
> >> FreeSWITCH-users mailing list
> >> FreeSWITCH-users at lists.freeswitch.org
> >> http://lists.freeswitch.org/mailman/listinfo/freeswitch-users
> >> UNSUBSCRIBE:
> http://lists.freeswitch.org/mailman/options/freeswitch-users
> >> http://www.freeswitch.org
> >>
> >
> > _______________________________________________
> > FreeSWITCH-users mailing list
> > FreeSWITCH-users at lists.freeswitch.org
> > http://lists.freeswitch.org/mailman/listinfo/freeswitch-users
> > UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users
> > http://www.freeswitch.org
> >
> >
>
> --
> View this message in context:
> http://n2.nabble.com/Subscribing-to-events-in-managed-C-NET-tp3573619p3614845.html
> Sent from the freeswitch-users mailing list archive at Nabble.com.
>
> _______________________________________________
> FreeSWITCH-users mailing list
> FreeSWITCH-users at lists.freeswitch.org
> http://lists.freeswitch.org/mailman/listinfo/freeswitch-users
> UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users
> http://www.freeswitch.org
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.freeswitch.org/pipermail/freeswitch-users/attachments/20090909/b8ed69ce/attachment-0002.html 


More information about the FreeSWITCH-users mailing list