mirror of
https://git.eden-emu.dev/eden-emu/eden
synced 2026-05-26 23:57:03 +02:00
fx
This commit is contained in:
parent
bf6d92f845
commit
5e2901391d
1 changed files with 12 additions and 0 deletions
|
|
@ -231,11 +231,23 @@ bool Event::WaitFor(const std::chrono::nanoseconds time) {
|
|||
}
|
||||
#else
|
||||
bool Event::WaitFor(const std::chrono::nanoseconds time) {
|
||||
#ifdef _WIN32
|
||||
auto const end = Common::g_wall_clock.GetTimeNS() + time;
|
||||
while (!is_set.load() && rem > 0) {
|
||||
Common::Windows::SleepForOneTick();
|
||||
if (Common::g_wall_clock.GetTimeNS() > end)
|
||||
break;
|
||||
}
|
||||
if (is_set.load())
|
||||
Reset();
|
||||
return true;
|
||||
#else
|
||||
std::unique_lock lk{mutex};
|
||||
if (!condvar.wait_for(lk, time, [this] { return is_set.load(); }))
|
||||
return false;
|
||||
is_set = false;
|
||||
return true;
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue