triggerInterrupt: Refactor to use break

This commit is contained in:
Robert Hensing 2022-02-21 15:43:43 +01:00
parent c3b942e0fc
commit ddb6740e7d

View file

@ -1599,20 +1599,18 @@ void triggerInterrupt()
{ {
InterruptCallbacks::Token i = 0; InterruptCallbacks::Token i = 0;
while (true) {
std::function<void()> callback; std::function<void()> callback;
do {
{ {
auto interruptCallbacks(_interruptCallbacks.lock()); auto interruptCallbacks(_interruptCallbacks.lock());
auto lb = interruptCallbacks->callbacks.lower_bound(i); auto lb = interruptCallbacks->callbacks.lower_bound(i);
if (lb != interruptCallbacks->callbacks.end()) { if (lb == interruptCallbacks->callbacks.end())
break;
callback = lb->second; callback = lb->second;
i = lb->first + 1; i = lb->first + 1;
} else {
callback = nullptr;
}
} }
if (callback) {
try { try {
callback(); callback();
} catch (...) { } catch (...) {
@ -1620,8 +1618,6 @@ void triggerInterrupt()
} }
} }
} }
while (callback);
}
} }
static sigset_t savedSignalMask; static sigset_t savedSignalMask;