mirror of
https://github.com/RetroDECK/Duckstation.git
synced 2024-11-29 17:15:40 +00:00
Timer: Spin for last 1ms on non-windows too
This commit is contained in:
parent
73a80d3a1d
commit
ae0d60fcd8
|
@ -186,8 +186,21 @@ void Timer::SleepUntil(Value value, bool exact)
|
||||||
{
|
{
|
||||||
if (exact)
|
if (exact)
|
||||||
{
|
{
|
||||||
while (GetCurrentValue() < value)
|
for (;;)
|
||||||
|
{
|
||||||
|
Value current = GetCurrentValue();
|
||||||
|
if (current >= value)
|
||||||
|
break;
|
||||||
|
|
||||||
|
static constexpr Value min_sleep_time = 1 * 1000000;
|
||||||
|
|
||||||
|
// spin for the last 1ms
|
||||||
|
if ((value - current) > min_sleep_time)
|
||||||
|
{
|
||||||
SleepUntil(value, false);
|
SleepUntil(value, false);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue