title: Will a thread sleep if told to sleep for zero seconds?
body: <p>My question is simple. If I use <code>std::this_thread::sleep_for(0ms)</code>, will the thread sleep at all?</p>
  
  <p>I know this seems like a silly question, but when I tell a thread to sleep for a very small amount (such as 10 microseconds), it often sleeps for at least 5-10 milliseconds. I know this is related to how operating systems schedule their processes. I just want to know how all of the corner cases work, as I have some code that may be slowing down due to sleeping for small, zero, or negative amounts of time.</p>
  
  <p>EDIT 1: I have simplified the question to just be about sleeping for zero seconds.</p>
  
  <p>EDIT 2: Many comments so far has been about how I shouldn't try to do this, but I both have a reason and I'm curious. In my code, I am not literally calling <code>std::this_thread::sleep_for(0ms)</code>, but instead, I am sleeping for a variable amount of time based on external conditions. When I compute the amount of time I need to sleep, the result can be positive, negative, or zero. I want to know if I am still sleeping for results less than or equal to zero.</p>