Threading in .Net (C#)
-
Hi, I have a page that calls a sql procedure and it runs for 20 - 40 min. I use usual threading for this page.
Thread objthread = new Thread(new ThreadStart(ticketingThread)); objthread.Start();
As i dont know when it will end. i never abort the thread. what happens is when user uses the page for 1 weeek, the page starts hanging. I dont know what happens. When i tried debugging it works fine. I also saw creating thread in threadpoolsThreadPool.QueueUserWorkItem(new WaitCallback(ticketingThread));
Please advise which one i have to follow and what is the difference between the two. Thanks Venky -
Hi, I have a page that calls a sql procedure and it runs for 20 - 40 min. I use usual threading for this page.
Thread objthread = new Thread(new ThreadStart(ticketingThread)); objthread.Start();
As i dont know when it will end. i never abort the thread. what happens is when user uses the page for 1 weeek, the page starts hanging. I dont know what happens. When i tried debugging it works fine. I also saw creating thread in threadpoolsThreadPool.QueueUserWorkItem(new WaitCallback(ticketingThread));
Please advise which one i have to follow and what is the difference between the two. Thanks VenkyHi Venky. I have nothing to hand here, but i remember that you can use a delegate to run the thread, and then a callback function which will terminate it. Im not sure how often this thread is getting created, but even if it is only once, it is good practice to terminate the thread when it has completed its job. Cheers Mark.