Basic Threading Question

  • Thread starter Thread starter Flashster
  • Start date Start date
F

Flashster

I've a form application that, as one of its functions, gets some data from a
web site.

I wanted to run the process on a thread so that the application doesn't get
tied up whilst the web process is running. However, I want to be able to
time out the thread if its 'completed' event isn't triggered within a set
amount of time.

What the best way to timeout an event? I've tried starting another 'timer'
thread that aborts the web thread when its reaches its timeout value, but it
seems that I must have done it wrong as the whole application slows down,
as it did when I didn't use any threads(!)

I understand that the thread.Join command stops pauses the application until
the thread finishes, so that won't help me.
 
I wanted to run the process on a thread so that the application doesn't get
tied up whilst the web process is running. However, I want to be able to
time out the thread if its 'completed' event isn't triggered within a set
amount of time.

How are you getting the website data? If you're using HttpWebRequest
the easiest way would be to set its Timeout property.


Mattias
 
I'll give it a try. Thanks
Mattias Sjögren said:
How are you getting the website data? If you're using HttpWebRequest
the easiest way would be to set its Timeout property.


Mattias
 

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

Similar Threads


Back
Top