mirror of
https://git.eden-emu.dev/eden-emu/eden
synced 2026-05-27 21:37:06 +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
|
#else
|
||||||
bool Event::WaitFor(const std::chrono::nanoseconds time) {
|
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};
|
std::unique_lock lk{mutex};
|
||||||
if (!condvar.wait_for(lk, time, [this] { return is_set.load(); }))
|
if (!condvar.wait_for(lk, time, [this] { return is_set.load(); }))
|
||||||
return false;
|
return false;
|
||||||
is_set = false;
|
is_set = false;
|
||||||
return true;
|
return true;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue