Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
High Resolution sleep #439
Implement a high resolution sleep method for threads.
The solution on Windows is to use timeBeginPeriod and timeEndPeriod to set the sleep resolution to 1 -- by default it is usually higher, on my machine the default is 16.
Please note that timeBeginPeriod should be called immediately before sleeping and timeEndPeriod should be called immediately after sleeping, as noted in the 'Remarks' section of the Microsoft page. If this is not done correctly it will effect all programs running on the computer and sometimes cause the computer to lag.