From 7e3092b83516e720ef367e8172421266078ee7e6 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Wed, 7 Aug 2019 08:27:11 +0200 Subject: Improve deadlock diagnostics (suppress stack trace, reword) --- build2/b.cxx | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) (limited to 'build2') diff --git a/build2/b.cxx b/build2/b.cxx index 2bb5920..8965d64 100644 --- a/build2/b.cxx +++ b/build2/b.cxx @@ -16,7 +16,7 @@ #include // strcmp(), strchr() #include #include // cout -#include // set_terminate(), terminate_handler +#include // terminate(), set_terminate(), terminate_handler #include #include // stderr_fd(), fdterm() @@ -152,6 +152,15 @@ custom_terminate () default_terminate (); } +static void +terminate (bool trace) +{ + if (!trace) + set_terminate (default_terminate); + + std::terminate (); +} + int build2:: main (int argc, char* argv[]) { @@ -412,7 +421,8 @@ main (int argc, char* argv[]) // Initialize the global state. // - init (argv[0], + init (&::terminate, + argv[0], !ops.serial_stop (), ops.dry_run (), (ops.mtime_check () ? optional (true) : ops.no_mtime_check () ? optional (false) : nullopt), -- cgit v1.1