mirror of
https://github.com/hedge-dev/UnleashedRecomp.git
synced 2026-04-27 04:41:39 +00:00
Cross-platform Sleep. (#37)
This commit is contained in:
parent
9dcadb9e06
commit
cc4953584f
1 changed files with 3 additions and 14 deletions
|
|
@ -419,18 +419,7 @@ DWORD KeDelayExecutionThread(DWORD WaitMode, bool Alertable, XLPQWORD Timeout)
|
||||||
if (Alertable)
|
if (Alertable)
|
||||||
return STATUS_USER_APC;
|
return STATUS_USER_APC;
|
||||||
|
|
||||||
timeBeginPeriod(1);
|
std::this_thread::sleep_for(std::chrono::milliseconds(GuestTimeoutToMilliseconds(Timeout)));
|
||||||
const auto status = SleepEx(GuestTimeoutToMilliseconds(Timeout), Alertable);
|
|
||||||
timeEndPeriod(1);
|
|
||||||
|
|
||||||
if (status == WAIT_IO_COMPLETION)
|
|
||||||
{
|
|
||||||
return STATUS_USER_APC;
|
|
||||||
}
|
|
||||||
else if (status)
|
|
||||||
{
|
|
||||||
return STATUS_ALERTED;
|
|
||||||
}
|
|
||||||
|
|
||||||
return STATUS_SUCCESS;
|
return STATUS_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
@ -649,7 +638,7 @@ void KfAcquireSpinLock(uint32_t* spinLock)
|
||||||
const auto ctx = GetPPCContext();
|
const auto ctx = GetPPCContext();
|
||||||
|
|
||||||
while (InterlockedCompareExchange((volatile long*)spinLock, ByteSwap(*(uint32_t*)(g_memory.Translate(ctx->r13.u32 + 0x110))), 0) != 0)
|
while (InterlockedCompareExchange((volatile long*)spinLock, ByteSwap(*(uint32_t*)(g_memory.Translate(ctx->r13.u32 + 0x110))), 0) != 0)
|
||||||
Sleep(0);
|
std::this_thread::yield();
|
||||||
}
|
}
|
||||||
|
|
||||||
uint64_t KeQueryPerformanceFrequency()
|
uint64_t KeQueryPerformanceFrequency()
|
||||||
|
|
@ -689,7 +678,7 @@ void KeAcquireSpinLockAtRaisedIrql(uint32_t* spinLock)
|
||||||
const auto ctx = GetPPCContext();
|
const auto ctx = GetPPCContext();
|
||||||
|
|
||||||
while (InterlockedCompareExchange((volatile long*)spinLock, ByteSwap(*(uint32_t*)(g_memory.Translate(ctx->r13.u32 + 0x110))), 0) != 0)
|
while (InterlockedCompareExchange((volatile long*)spinLock, ByteSwap(*(uint32_t*)(g_memory.Translate(ctx->r13.u32 + 0x110))), 0) != 0)
|
||||||
Sleep(0);
|
std::this_thread::yield();
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t KiApcNormalRoutineNop()
|
uint32_t KiApcNormalRoutineNop()
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue