Mr Wednesday
Mr Wednesday

Reputation: 552

To thread or not to thread

I'm building a rather simple application that performs a few seperate HTTPWebRequests, each on their own timer. It's not likely I will need to have more than 3 seperate requests running at a time.

If a Timer Tick fires while another HTTPWebRequest is in progress, what happens to the event fired by the Timer Tick? Should I add Threading?

Upvotes: 10

Views: 596

Answers (2)

Alexei Levenkov
Alexei Levenkov

Reputation: 100527

The answer is almost always - no, don't use threads just because you can.

Consider making asynchronous calls first as it is easier to write correct code for. It is likely more efficient use of resources (as threads are not unlimited resource) if you need additional arguments.

Links:

Upvotes: 6

the_joric
the_joric

Reputation: 12226

When Timer.Tick fires it's handler will be scheduled for execution in Thread Pool and most likely, executed in another thread.

Upvotes: 1

Related Questions