2
Answers

Abort thread dont work.

Pavol

Pavol

11y
1.2k
1
Hi
Abort() thread dont work.
I got the following code:

class communication

private UdpClient client;

{

public communication()

{
    t = new Thread(new ThreadStart(listen));

}

public void listen()

{......}

}


and in form1 i got the code:

communication com=new commnunication();

com.t.Start();     //start thread works

.

.

.

any code

com.t.Abort();     //abort thread dont works

Why dont works abort thread?



Answers (2)
0
Vulpes

Vulpes

NA 98.3k 1.5m 11y
There are various reasons why Thread.Abort may not work immediately or even at all.

Check the documentation on this method for full details:

http://msdn.microsoft.com/en-us/library/ty8d3wta.aspx
0
Iftikar Hussain

Iftikar Hussain

NA 18.9k 275.5k 11y
Hi,
        Try like this

com.t.Abort(); 
// Wait for the thread to terminate.
com.t..Join();

Regards,
Iftikar