473,387 Members | 1,611 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Threading ...

ron
If I use the System.Threading.ThreadPool.QueueUserWorkItem to spawn a new
threaded process, will this process be executed regardless of whether or not
the current process ends prior to completion of the child thread? Or do I
need to create a new thread object and join it to my current thread in order
to guarantee execution of code in a child process?

-Ron
Jul 21 '05 #1
3 2793
If you successfully start a process by using
System.Diagnostics.Process.Start() method then it will execute regardless of
what the code that started it does. It is a separate process, not a child
process of the process that created it.

"ron" <rr***@crosscurrent.com> wrote in message
news:Oh*************@TK2MSFTNGP12.phx.gbl...
If I use the System.Threading.ThreadPool.QueueUserWorkItem to spawn a new
threaded process, will this process be executed regardless of whether or not the current process ends prior to completion of the child thread? Or do I
need to create a new thread object and join it to my current thread in order to guarantee execution of code in a child process?

-Ron

Jul 21 '05 #2
Ron
Threads started under the System.Threading.Thread class
cannot be included in a new process under the
System.Diagnostics.Process. Instead you need to use the
System.Diagnostics.ProcessThread class. This doesn't work
for me under the current architecture. I'll likely need
to join to the current thread in order to guarantee
execution.

-Ron
-----Original Message-----
If you successfully start a process by using
System.Diagnostics.Process.Start() method then it will execute regardless ofwhat the code that started it does. It is a separate process, not a childprocess of the process that created it.

"ron" <rr***@crosscurrent.com> wrote in message
news:Oh*************@TK2MSFTNGP12.phx.gbl...
If I use the System.Threading.ThreadPool.QueueUserWorkItem to spawn a
new threaded process, will this process be executed regardless of whether or
not
the current process ends prior to completion of the
child thread? Or do I need to create a new thread object and join it to my

current thread inorder
to guarantee execution of code in a child process?

-Ron

.

Jul 21 '05 #3
If you want to start a unit of execution within the same managed process
then use a System.Threading.Thread - this creates a managed thread within
the same process. You can then use thread.Join to wait for that thread to
complete. If it's not one of your threads (e.g. a threadpool) then you can
use an event to signal the completion of the work, and then use
WaitOne(event) in the main thread to wait for it to complete.

If you want more isolation you can create another appdomain and run it in
that appdomain. You can also run an executable in another appdomain using
appDomain.ExecuteAssembly(assemblyPath), where appDomain is a reference to
another appdomain.

You can also use a named mutex for interprocess signalling. You can launch
another process, win32 or managed code, and when that code completes it sets
a mutex to the signalled state. The launching program can wait for that
mutex to be signalled.

It's not clear to me what you are trying to accomplish so it's not possible
to determine what the best approach would be.

"Ron" <rr***@crosscurrent.com> wrote in message
news:07****************************@phx.gbl...
Threads started under the System.Threading.Thread class
cannot be included in a new process under the
System.Diagnostics.Process. Instead you need to use the
System.Diagnostics.ProcessThread class. This doesn't work
for me under the current architecture. I'll likely need
to join to the current thread in order to guarantee
execution.

-Ron
-----Original Message-----
If you successfully start a process by using
System.Diagnostics.Process.Start() method then it will

execute regardless of
what the code that started it does. It is a separate

process, not a child
process of the process that created it.

"ron" <rr***@crosscurrent.com> wrote in message
news:Oh*************@TK2MSFTNGP12.phx.gbl...
If I use the System.Threading.ThreadPool.QueueUserWorkItem to spawn a
new threaded process, will this process be executed regardless of whether or
not
the current process ends prior to completion of the

child thread? Or do I need to create a new thread object and join it to my

current thread in
order
to guarantee execution of code in a child process?

-Ron

.

Jul 21 '05 #4

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

Similar topics

65
by: Anthony_Barker | last post by:
I have been reading a book about the evolution of the Basic programming language. The author states that Basic - particularly Microsoft's version is full of compromises which crept in along the...
2
by: Egor Bolonev | last post by:
hi all my program terminates with error i dont know why it tells 'TypeError: run() takes exactly 1 argument (10 given)' =program==================== import os, os.path, threading, sys def...
77
by: Jon Skeet [C# MVP] | last post by:
Please excuse the cross-post - I'm pretty sure I've had interest in the article on all the groups this is posted to. I've finally managed to finish my article on multi-threading - at least for...
6
by: CK | last post by:
I have the following code in a windows service, when I start the windows service process1 and process2 work fine , but final process (3) doesnt get called. i stop and restart the windows service...
2
by: Vjay77 | last post by:
In this code: Private Sub downloadBtn_Click(ByVal sender As Object, ByVal e As System.EventArgs) If Not (Me.downloadUrlTextBox.Text = "") Then Me.outputGroupBox.Enabled = True...
11
by: Paul Sijben | last post by:
I am stumped by the following problem. I have a large multi-threaded server accepting communications on one UDP port (chosen for its supposed speed). I have been profiling the code and found...
17
by: OlafMeding | last post by:
Below are 2 files that isolate the problem. Note, both programs hang (stop responding) with hyper-threading turned on (a BIOS setting), but work as expected with hyper-threading turned off. ...
0
by: kingcrowbar.list | last post by:
Hello Everyone I have been playing a little with pyGTK and threading to come up with simple alert dialog which plays a sound in the background. The need for threading came when in the first...
7
by: Mike P | last post by:
I am trying to write my first program using threading..basically I am moving messages from an Outlook inbox and want to show the user where the process is up to without having to wait until it has...
126
by: Dann Corbit | last post by:
Rather than create a new way of doing things: http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2008/n2497.html why not just pick up ACE into the existing standard:...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
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,...
0
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...

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.