forked from lix-project/lix
triggerInterrupt: Refactor to use break
This commit is contained in:
parent
c3b942e0fc
commit
ddb6740e7d
|
@ -1599,28 +1599,24 @@ void triggerInterrupt()
|
||||||
|
|
||||||
{
|
{
|
||||||
InterruptCallbacks::Token i = 0;
|
InterruptCallbacks::Token i = 0;
|
||||||
std::function<void()> callback;
|
while (true) {
|
||||||
do {
|
std::function<void()> callback;
|
||||||
{
|
{
|
||||||
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())
|
||||||
callback = lb->second;
|
break;
|
||||||
i = lb->first + 1;
|
|
||||||
} else {
|
callback = lb->second;
|
||||||
callback = nullptr;
|
i = lb->first + 1;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (callback) {
|
try {
|
||||||
try {
|
callback();
|
||||||
callback();
|
} catch (...) {
|
||||||
} catch (...) {
|
ignoreException();
|
||||||
ignoreException();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
while (callback);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue