I stop a thread execution with .Abort()
and .Join()
for wait the thread terminates. But the problem is that .Join()
never unblock application, same when thread was terminated. Why? my code:
th.Abort();
Console.WriteLine("request sent, please wait..");
th.Join();
Console.WriteLine("done!");
the above code never unlock application, but it works fine:
th.Abort();
Console.WriteLine("request sent, please wait..");
while (serverTh.ThreadState != ThreadState.Aborted) {
Thread.Sleep(500);
}
Console.WriteLine("done!");
Thanks in advance.