aboutsummaryrefslogtreecommitdiff
path: root/build2/b.cxx
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2019-08-07 08:27:11 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2019-08-07 08:27:11 +0200
commit7e3092b83516e720ef367e8172421266078ee7e6 (patch)
treed148680100da8dc9ae9a634bce9a82364825b20e /build2/b.cxx
parent20ce40e34faf6b08f8c3bb9a149a3975fd4403cc (diff)
Improve deadlock diagnostics (suppress stack trace, reword)
Diffstat (limited to 'build2/b.cxx')
-rw-r--r--build2/b.cxx14
1 files changed, 12 insertions, 2 deletions
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 <cstring> // strcmp(), strchr()
#include <typeinfo>
#include <iostream> // cout
-#include <exception> // set_terminate(), terminate_handler
+#include <exception> // terminate(), set_terminate(), terminate_handler
#include <libbutl/pager.mxx>
#include <libbutl/fdstream.mxx> // 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<bool> (true) :
ops.no_mtime_check () ? optional<bool> (false) : nullopt),