Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7082357
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T07:02:33+00:00 2026-05-28T07:02:33+00:00

Possible Duplicate: Compare using Thread.Sleep and Timer for delayed execution I am considering whether

  • 0

Possible Duplicate:
Compare using Thread.Sleep and Timer for delayed execution

I am considering whether to use a System.Threading.Timer or Thread.Sleep in my ASP.NET Web Application. I looked for the differences of them. Period or the Sleep will be 100ms.
AFAIK if I use a Timer it will not block running thread, but Sleep will block running thread.

Since the interval is very small, would it be better to choose Thread.Sleep(150) ?

Edit: I tend to use it like a timer on not thread pool thread. I know Timers will be run on thread pool, but I don’t want to keep thread pool thread for such an operation

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T07:02:34+00:00Added an answer on May 28, 2026 at 7:02 am

    Thread.Sleep() has some uses for which it is vital. These are few and far between, and if you’re using any number higher than about 1 as the argument you almost certainly don’t have one.

    If it’s even possible for a timer to be used instead, then you definitely don’t have one. Don’t block a perfectly good thread when the alternative isn’t even difficult.

    Do be careful of the case where a timer is triggered while the previous trigger is still running. Depending on the nature of the operation you will want to either:

    1. Ignore this, if the code called is safe for multiple simultaneous calls then this may be fine. Of course, you have to know that it’s fine.
    2. Lock on the timer-triggered operation. Be aware that you can end up with a queue of lots of pending operations.
    3. Lock on the timer-triggered operation, try to obtain the lock with a timeout of zero and if you fail then skip it – there’s a thread still here from the last time.
    4. Have the timer as a one-off timer that you restart at the end of each call.
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Possible Duplicate: How to compare 2 files fast using .NET? How can I compare
Possible Duplicate: Why not use tables for layout in HTML? Under what conditions should
Possible Duplicate: How do you send email from a Java app using Gmail? How
Possible Duplicate: LINQ - Where not exists I'm using LINQ2SQL and I want to
Possible Duplicate: How to count duplicates in Ruby Arrays Ruby: Compare 2 arrays for
Possible Duplicate: Compare 2 dates with JavaScript Compare two dates in JavaScript I am
Possible Duplicate: Compare 2 dates with JavaScript I haven't done much JavaScript. I am
Possible Duplicate: Compare 2 dates with JavaScript Hi, I'm working on form validation for
Possible Duplicate: How to compare strings? ( == returns wrong value) I have the
Possible Duplicate: Differences in string compare methods in C# Is there any difference between

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.