impr: Make ImHex not use lots of CPU when waiting for conditions

This commit is contained in:
WerWolv
2023-06-18 10:18:58 +02:00
parent 03f377bf40
commit 5f6bc2507c
2 changed files with 4 additions and 3 deletions

View File

@@ -16,9 +16,10 @@ namespace hex::plugin::builtin {
void handleNetworkInterfaceService() {
if (!networkInterfaceServiceEnabled) {
std::this_thread::yield();
std::this_thread::sleep_for(std::chrono::milliseconds(100));
return;
}
static wolv::net::SocketServer networkInterfaceServer(31337);
networkInterfaceServer.accept([](auto, const std::vector<u8> &data) -> std::vector<u8> {
nlohmann::json result;

View File

@@ -880,7 +880,7 @@ namespace hex::plugin::builtin {
*this->m_breakpointHit = true;
this->m_resetDebuggerVariables = true;
while (*this->m_breakpointHit) {
std::this_thread::yield();
std::this_thread::sleep_for(std::chrono::milliseconds(100));
}
});
@@ -900,7 +900,7 @@ namespace hex::plugin::builtin {
this->m_dangerousFunctionCalled = true;
while (this->m_dangerousFunctionsAllowed == DangerousFunctionPerms::Ask) {
std::this_thread::yield();
std::this_thread::sleep_for(std::chrono::milliseconds(100));
}
return this->m_dangerousFunctionsAllowed == DangerousFunctionPerms::Allow;