Threads and AppDomain

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hello all!

Im 'trying' to make a plugin-based application (system) - everything except
the main window are plugins (all other sub-windows, panels, etc).

Each plugin comes from dll's.. and each dll is loaded on a separate
AppDomain..
my question:
Does creating a new AppDomain, automatically start a new thread?

Does this mean, that each of my plugin runs on their own thread? -which is
really my intention. Is this approach even a good one?

<im new to dotnet/appdomains, but is familiar with threading concepts..
this one is just confusing for me>

thanks for any help.
 
Ah well you have a choice - I would PING Nicholas Paldino or Jon Skeet, both
C#/NET MVP's, well versed in the subject and lurk here often. To be honest,
the groups are well tended by many experts in .NET so you could ask your
questions here anyway and see what answers came back.
--
Regards

John Timney (MVP)
VISIT MY WEBSITE:
http://www.johntimney.com
 
mickeymicks said:
Im 'trying' to make a plugin-based application (system) - everything except
the main window are plugins (all other sub-windows, panels, etc).

Each plugin comes from dll's.. and each dll is loaded on a separate
AppDomain..
my question:
Does creating a new AppDomain, automatically start a new thread?
No.

Does this mean, that each of my plugin runs on their own thread? -which is
really my intention. Is this approach even a good one?

Well, running each plugin in a different AppDomain has its advantages,
although it makes life slightly trickier in terms of passing objects
around between plugins and the main application.

If you want to run each plugin in a different thread (and without
knowing the details of what the plugins do, it's hard to say whether or
not that's a good idea) you'll need to start the extra threads
yourself.
 
hello all!
now, im thinking of allowing a plugin to run on its own thread and/or its
own domain (w/c basically complicates my life more).
Well, running each plugin in a different AppDomain has its advantages,
yeah, kinda considered appdomains, for isolation of the plugins. because in
the type of plugins i have, there's a big chance that one plugin might hang
or breakdown.. and thru appdomains i could prevent the rest of the plugins
(the ones that are still ok) from joining in the 'headache'. right?
knowing the details of what the plugins do...
that's basically it: my host program (main window and all) will load some
plugins. and thru a plugin interface it only knows two functions - Start()
and Stop(). my host program doesnt know what the plugins do, it just calls
the start and stop functions.

Normally, the Start() function in a plugin, contains showing of a window.
So, in a non-'multithreaded' system, i would just invoke the Start for each
plugin. On the other hand, for multithreaded system, i would be invoking the
Start() inside a new thread. Sounds really, simple.. but is this correct?
What are the things that i should worry about? - i.e. about the marshalling
of data, im still researching about it.

also in my plugin system, i have an "event engine" wherein plugins can:
register new events, subscribe to a registered event, and trigger a
registered event. this event engine will be my communications for
host-plugins and plugin-to-plugins. since, the plugins might be on a separate
thread or domain, i know i need to worry about marshalling again (for the
event arguments). Could you give me some idea on how to go about this, or at
least a good reference, particularly about events across multple threads?
Please :)

thanks for the replies! ..i really appreciate it.
 
Back
Top