1
0
Fork 0
mirror of https://github.com/NixOS/nix synced 2025-07-05 12:21:48 +02:00

Merge pull request #11665 from roberth/fix-Interrupted-falling-out-of-thread

Fix `Interrupted` falling out of thread crash
This commit is contained in:
Robert Hensing 2024-10-16 20:09:29 +02:00 committed by GitHub
commit f51974d698
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 18 additions and 3 deletions

View file

@ -110,10 +110,15 @@ void ThreadPool::doWork(bool mainThread)
propagate it. */
try {
std::rethrow_exception(exc);
} catch (const Interrupted &) {
// The interrupted state may be picked up by multiple
// workers, which is expected, so we should ignore
// it silently and let the first one bubble up,
// rethrown via the original state->exception.
} catch (const ThreadPoolShutDown &) {
// Similarly expected.
} catch (std::exception & e) {
if (!dynamic_cast<ThreadPoolShutDown*>(&e))
ignoreExceptionExceptInterrupt();
} catch (...) {
ignoreExceptionExceptInterrupt();
}
}
}