1
Answer

Simple Threading

Ask a question
j_sen21

j_sen21

16y
2.1k
1

Have forgotten my ways with threading!

I just want to make sure the thread will stop after the call. This code executes under the timer1. Im assuming that after the thread is created and the function finishes, the thread terminated itself. I wated process under ctrl,alt, delete and I am fairly confident it is working.

Am I correct, ( Im worried Im creating a problem down the road)???

Thanks

private void timer1_Tick(object sender, EventArgs e)

{

Thread t = new Thread(runningTimer);

t.Start();

}

private void runningTimer()

{

System.Net.WebRequest req = System.Net.WebRequest.Create(grate.ToString() + "?wsdl");

try

{

m_wr = req.GetResponse();

m_wr.Close();

}

catch{}

if (m_wr != null)

{

bconnected = true;

}

else

{

bconnected = false;

}

m_wr = null;

}


Answers (1)