use sleep_for to avoid WIN32 sleep_until bug

This commit is contained in:
Zach Pomerantz 2017-01-27 13:19:41 -05:00
parent 5ed376afc9
commit d82c8b251a

View file

@ -468,7 +468,9 @@ std::chrono::microseconds AudioMixer::timeFrame(p_high_resolution_clock::time_po
timestamp = std::max(now, nextTimestamp);
// sleep until the next frame should start
std::this_thread::sleep_until(timestamp);
// WIN32 sleep_until is broken until VS2015 Update 2
// instead, std::max (above) guarantees that timestamp >= now, so we can sleep_for
std::this_thread::sleep_for(timestamp - now);
return duration;
}