I'm using C# .Net4.0 in VS 2010.
How do I restart a Thread
?
Its like I want to Abort()
the thread and Start()
it from the beginning again?
Is it possible?
Abort a thread is often a bad idea. He is an advisor. If it's an infinite loop, a boolean used to stop the thread without the abortion.
bool run = true;
Thread thread = new Thread(method);
thread.start();
private void method()
{
while(run)
{
}
}
To stop the thread, just set the boolean to false and normally, you can restart it later.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With