Threadpool timeout

  • Thread starter Thread starter VB.NET
  • Start date Start date
V

VB.NET

Good Afternoon, Is it possible to start a thread with threadpool and either
abort it or set a timeout to kill the thread if it goes longer than a given
amount of time?
 
'-- Put in thread
Dim start As DateTime = DateTime.Now
'-- In minutes
Const timeout As Integer = 1

Do While DateTime.Now.Subtract(start).TotalMinutes < timeout

'-- Do work

Loop
 
That will loop through the '-- Do Work. I want the code to run once. Also,
it would only jump out of the loop when it got to the end and the initial
conditions were not met. I need it to kill it if it hangs on function.
Thanks for the input, however.
 
It get's stuck on data downloads from webservices. It's one line:
xmldocument.load(site). if the server is too busy or the connection isn't
great, it locks up. Thats why i want to kill a threadpool.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top