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

  • Home
  • SEARCH
  • 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 7843233
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T16:30:16+00:00 2026-06-02T16:30:16+00:00

I need prety simple thing while (true) { DoJob(); // wait 1 ms }

  • 0

I need prety simple thing

while (true) {
    DoJob();
    // wait 1 ms
}

Should I just use Thread.Sleep(1)?
I’m not sure about using Timer because it seems overhead of Timer itself is a little bit more than 1 ms.

Update: I need this delay to be sure that I received the most recent information from network, it’s trading software. I need to do something and then I have to wait 1 ms to see what happens. I can wait 1.5 ms, but not 3 ms, that would be too much. It’s ok to wait rarely 5 or 10 ms, but in general it should be ~1 ms

  • 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-06-02T16:30:17+00:00Added an answer on June 2, 2026 at 4:30 pm

    Edit — corrected “most resolution you will get from sleep to about 20 ms, instead of 100 ms

    About the most resolution that you will get out of sleep is 100 milliseconds, even if you pass Sleep(1).

    For what it’s worth, a timer may be more efficient for this — especially if you have more than 1 thread sleeping (System.Threading.Timer will will use as few threads as it needs to if you allocate multiple timers, they will share a timing thread) (this from Joe Duffy’s Concurrent Programming book)

    But more importantly, what are you trying to do? If you are polling — need to wait for something to happen, you may be able to use a more efficient means of doing it. If you just need to fire off a task every so often, A timer is probably going to be your best bet.

    If you are only want to stop for a millisecond, may I ask why? Are you just trying to make sure that your thread yields to other processes?

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This seems like it should be simple, but maybe I'm missing something. I just
I think the question is pretty simple, do I need all the rest of
I have a pretty simple SQL I need to perform. I have a ProcessUser
Basically, why the need for two abstractions of a pretty simple concept?
I'm pretty close to having this figured out and just need the last bit
I need to have a status message that is set while processing an initial
I'm having trouble with what I thought should be a pretty simple problem. I
I'm pretty sure that this question already has been answered somewhere. It just seems
All I need to do is a simple read from a file in the
This problem is pretty simple, I think. The thing is: My TextView (Which is

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.