Is it possible to end the Main() thread while the other threads continue?

Is it possible to end the Main() thread while the other threads continue?

Post by Edwi » Mon, 07 Nov 2005 06:17:51


Hello,

I would like the Main()-thread to end (because it runs out of the
code), but all started threads should continue. Is this possible.

Eg.

[STAThread]
static void Main(string[] args)
{
System.Threading.Thread threadGUI = new
System.Threading.Thread(new
System.Threading.ThreadStart(Recdump.StartGUI));
threadGUI.Start();
}

So, after I run the program, the thread running Main() should end, but
the thread running Recdump.StartGUI should continue. Is that possible?

Actually, what I really want is an application which initially can
write to the Console, but after a while, when a form has been started,
returns to the command prompt.

I hope somebody can help...

Kind regards,

Edwin.
 
 
 

Is it possible to end the Main() thread while the other threads continue?

Post by Marcus And » Mon, 07 Nov 2005 09:37:18

On 5 Nov 2005 13:17:51 -0800, "Edwin" < XXXX@XXXXX.COM >



Try threadGUI.IsBackground = false;



Marcus Andr

 
 
 

Is it possible to end the Main() thread while the other threads continue?

Post by Marcus And » Mon, 07 Nov 2005 09:49:47


Began to doubt myself after I wrote this. While this is the correct
way to keep a program running when the main thread terminates, it
won't help you.

The program will keep running, but the problem for you is that as long
as the program is running it will keep blocking the console window.

What you want is to disconnect the process from the console window. I
don't know if there exists a way to do that.

Marcus Andr