Quick Threading Question
-
How do you spin a process off onto another thread and wait for it to complete? I'm looking for something like when you call ShowDialog and the process stops until the dialog has been closed.
You are looking for the WaitForExit[^] method on the Process[^] class. Regards Senthil _____________________________ My Blog | My Articles | WinMacro
-
You are looking for the WaitForExit[^] method on the Process[^] class. Regards Senthil _____________________________ My Blog | My Articles | WinMacro
-
If your question was how to kick off a seperate process (e.g. another application) from within you current program then the previous answer will be the key, however it looked from your question as if you wanted to kick off a seperate THREAD from within your program, in that case you would create a new thread, start it off and then call Join to wait for it to finish. e.g
ThreadStart ts = new ThreadStart(StartExtrapolation); // Name of some void function Thread thThread = new Thread(ts); thThread.Start(); thThread.Join(); // Can take a timeout variable as well if you want // Any code after this will either happen after the thread has finished or if a timeout occured
-
If your question was how to kick off a seperate process (e.g. another application) from within you current program then the previous answer will be the key, however it looked from your question as if you wanted to kick off a seperate THREAD from within your program, in that case you would create a new thread, start it off and then call Join to wait for it to finish. e.g
ThreadStart ts = new ThreadStart(StartExtrapolation); // Name of some void function Thread thThread = new Thread(ts); thThread.Start(); thThread.Join(); // Can take a timeout variable as well if you want // Any code after this will either happen after the thread has finished or if a timeout occured