   Sleep
  what is the code for the sleep function again?   
  n/m   ;  usleep(microseconds) [*nix]Sleep(milliseconds) [windows]sleep(seconds) [everywhere]   ;  On the same topic, what does Sleep(0) accomplish?   ;Quote:Original post by MoeOn the same topic, what does Sleep(0) accomplish?It yields control to the system, giving what remains of the current timeslice to the OS to use on another process or thread.   ;  Does it not do that automatically?   ;  Yes, but at random intervals. Sleep(0) is a hint to the computer: "I really don't care if you want to pause me right now. So if you're going to do it, do it now, not in a couple of milliseconds." Sometimes useful to improve system responsiveness during heavy CPU usage.   ;  It does that automatically (in preemptive schedulers).However, if your program contains polling loops like  while( ... )  {    ...    Sleep( 0 );  }the Sleep call will allow scheduler to reschedule tasks in more optimal manner.Otherwise it assumes that each and every CPU tick assigned for your task will be used properly (and not just burnt in tight polling loop).   