473,666 Members | 2,337 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Threads and AppDomain


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.

--
It is only through the heart that one can see rightly. (The Little Prince)

MickeyMicks
Oct 20 '06 #1
5 6707
No, creating a new application domain doesn't automatically create a
new thread. however you can create and execute one or more threads
within a new AppDomain if you need to.

More info here:
http://msdn2.microsoft.com/en-us/library/a60kkx8k.aspx

--
Chris Fulstow
MCP, MCTS
http://chrisfulstow.blogspot.com/
mickeymicks wrote:
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.

--
It is only through the heart that one can see rightly. (The Little Prince)

MickeyMicks
Oct 20 '06 #2
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
"mickeymick s" <mi*********@di scussions.micro soft.comwrote in message
news:5B******** *************** ***********@mic rosoft.com...
>
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.

--
It is only through the heart that one can see rightly. (The Little Prince)

MickeyMicks

Oct 21 '06 #3
mickeymicks <mi*********@di scussions.micro soft.comwrote:
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.

--
Jon Skeet - <sk***@pobox.co m>
http://www.pobox.com/~skeet Blog: http://www.msmvps.com/jon.skeet
If replying to the group, please do not mail me too
Oct 22 '06 #4
hmmmmm........I 'm sure I posted this in response to a different
question.....ho w odd!!!

--
--
Regards

John Timney (MVP)
VISIT MY WEBSITE:
http://www.johntimney.com
http://www.johntimney.com/blog
"John Timney (MVP)" <x_****@timney. eclipse.co.ukwr ote in message
news:hu******** *************** *******@eclipse .net.uk...
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
"mickeymick s" <mi*********@di scussions.micro soft.comwrote in message
news:5B******** *************** ***********@mic rosoft.com...
>>
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.

--
It is only through the heart that one can see rightly. (The Little
Prince)

MickeyMicks


Oct 23 '06 #5
hello all!
Does creating a new AppDomain, automatically start a new thread?
No.
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?
>If you want to run each plugin in a different thread (and without
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.

--
It is only through the heart that one can see rightly. (The Little Prince)
MickeyMicks
Oct 30 '06 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

10
8559
by: Cool Guy | last post by:
Consider: void Start() { if (!TryToDoSomething()) ShowErrorMessage(); }
0
1468
by: Benny | last post by:
Hi, My application creates a number of aync threads....i want to make sure that all these threads are of the invariant culture. So, how do i ensure that whenever a new thread is created in my appdomain, it is of this culture? Thanks in advance, A G Benny
2
2316
by: Brett | last post by:
What are the advantages/disadvantages of using one process with multiple threads or doing the same task with multiple processes, each having one thread? I see using multiple threads under one process as being a problem. Potentially, one thread may crash and could bring down the whole process, including all the other threads. Using one process per thread seems more independent. This is similar to what happens when you open multiple...
2
1320
by: mmitchell | last post by:
I have a service that executes a method in a dll. This method spawns several threads. When I stop the service I notice the process doesn't stop right away. I assume the threads that some time to finish. What can I don the the OnStop method to insure all threads are completed before stopping the service? Thanks for any help.
3
7298
by: Mike Binks | last post by:
I wish to make sure all unhandled exceptions (UE) are handled by a central handler. For primary thread UEs, this may be done by string exceptionText; AppDomain.CurrentDomain.UnhandledException += delegate(object sender, UnhandledExceptionEventArgs e) { exceptionText = e.ExceptionObject.ToString();
3
1389
by: michdoh | last post by:
Hi All I'm looking for some help on creating a basic multi threaded application. i'n new to threads in this environment so for test purposes I've produced a very basic program. (which doesn't work) Calling the 2 methods directly has the desired effect however when I try to impelment them as threads nothing happens.
0
1196
by: Mike Schilling | last post by:
Is there any way to list all the threads currently running for an AppDomain, or even for a process? That is, having caught a CannotUnloadAppDomainException telling you that some threads are still active, what do you do to figure out which they are?
20
541
by: greg.johnsen80 | last post by:
I have been struggling with the following problem: In my console application I have function1 calling function2 which in turn uses threads to do computationally intensive tasks. Some of the threads generate exceptions which cause the whole application to abort. How can I avoid termination and make function1 call function2 again in case of exceptions. Any ideas would be highly appreciated.
0
1860
by: jeremyje | last post by:
I would like to create an application where I have many concurrent processes being managed by a monitoring process. Each process that is "managed" will be invoked from an assembly dll (think reflection). I want a way to invoke these processes in parallel utilizing multi-core processors but I'd like to have the protection that AppDomains provide. I was doing some research where I found that there is no true isolation between threads and...
0
8440
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8863
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8780
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
7378
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6189
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5661
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4192
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
2
2005
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1763
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.