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

Michael Giagnocavo mgg at giagnocavo.net
Wed Sep 9 16:50:59 PDT 2009


The ILoadNotifcationPlugin is run in the appdomain created for the plugin, so it should only get unloaded when the plugin gets reloaded. Spawning threads here should work, it's definitely the intention that if you need a long-running process, you can fire it up on load and have it work.

As to the race condition on reload, mod_managed should do this:

	- Load the new plugin into a new appdomain
	- Remove the entry points to the old appdomain, add entries to the new one
	- Old appdomain now stays alive until foreground API and APP calls finish

So, you can have many versions of the same plugin active in memory. 

I probably need to go break compatibility and make ILoadWhateverPlugin be something like IPluginController and allow it to return loading options to control the mod_managed behavior, as well as allow it to delay shutdown of the appdomain. Part of the question is: how many people out there need compatibility, or can we go breaking all of you and make you recompile? :)

Although, IIRC, if you handle AppDomain.Unload (or whatever it is), it will stay alive until your event handler completes. 

Hope that helps a bit.

-Michael

 
-----Original Message-----
From: freeswitch-users-bounces at lists.freeswitch.org [mailto:freeswitch-users-bounces at lists.freeswitch.org] On Behalf Of Jeff Lenk
Sent: Wednesday, September 09, 2009 1:57 PM
To: freeswitch-users at lists.freeswitch.org
Subject: Re: [Freeswitch-users] Subscribing to events in managed C# / .NET


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




More information about the FreeSWITCH-users mailing list