From 8a997b04f33bb3383d5af0cc3a8bcafe90bbe319 Mon Sep 17 00:00:00 2001 From: Duke Date: Sun, 9 Jun 2024 11:22:21 -0400 Subject: [PATCH] Check if the node should stop when processing thread interrupts and exceptions, in hopes of stopping before a deadlock occurs --- src/util.h | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/util.h b/src/util.h index eeef26f86..ccc3f0486 100644 --- a/src/util.h +++ b/src/util.h @@ -47,6 +47,8 @@ static const bool DEFAULT_LOGTIMEMICROS = false; static const bool DEFAULT_LOGIPS = false; static const bool DEFAULT_LOGTIMESTAMPS = true; +void CheckIfWeShouldStop(); + /** Signals for translation. */ class CTranslationInterface { @@ -272,14 +274,17 @@ template void TraceThread(const char* name, Callable func) catch (const boost::thread_interrupted&) { LogPrintf("%s thread interrupt\n", name); + CheckIfWeShouldStop(); throw; } catch (const std::exception& e) { PrintExceptionContinue(&e, name); + CheckIfWeShouldStop(); throw; } catch (...) { PrintExceptionContinue(NULL, name); + CheckIfWeShouldStop(); throw; } }