Skip to content

Alternative implementation for Microsoft C++ runtime std::this_thread::sleep_for which is buggy as it uses the system clock which isn't steady.

Notifications You must be signed in to change notification settings

aholzinger/sleep_for

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 

Repository files navigation

sleep_for

Alternative implementation for Microsoft C++ runtime std::this_thread::sleep_for which is buggy as it uses the system clock which isn't steady.

See https://developercommunity.visualstudio.com/content/problem/58530/bogus-stdthis-threadsleep-for-implementation.html

It would even be more beneficial to implement the sleep_for/wait_for functions without the detour via absolute time and directly use Wondows' Sleep function. In an ideal world we could choose the chrono clock for sleeping/waiting which is a long missing feature at least under Windows where it a sub-millisecond sleep/wait is still not available. Like i.e. sleeping/waiting on std::chrono::steady_clock which is based on QuerePerformanceFrequency/QueryPerformanceCounter.

The implementation in this repo is far from being perfect. It's just meant to be a basis for discussion.

About

Alternative implementation for Microsoft C++ runtime std::this_thread::sleep_for which is buggy as it uses the system clock which isn't steady.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages