aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--build2/algorithm.cxx6
-rw-r--r--build2/diagnostics1
-rw-r--r--build2/dump.cxx3
-rw-r--r--build2/test/rule.cxx3
-rw-r--r--build2/test/script/builtin.cxx3
-rw-r--r--build2/test/script/parser.cxx3
6 files changed, 14 insertions, 5 deletions
diff --git a/build2/algorithm.cxx b/build2/algorithm.cxx
index 9357632..c9396ef 100644
--- a/build2/algorithm.cxx
+++ b/build2/algorithm.cxx
@@ -487,7 +487,8 @@ namespace build2
}
catch (const std::exception& e)
{
- *diag_stream << "unhandled exception: " << e;
+ diag_lock l;
+ *diag_stream << "unhandled exception: " << e << endl;
assert (false);
abort ();
}
@@ -789,7 +790,8 @@ namespace build2
}
catch (const std::exception& e)
{
- *diag_stream << "unhandled exception: " << e;
+ diag_lock l;
+ *diag_stream << "unhandled exception: " << e << endl;
assert (false);
abort ();
}
diff --git a/build2/diagnostics b/build2/diagnostics
index b889fd4..2c2b4bb 100644
--- a/build2/diagnostics
+++ b/build2/diagnostics
@@ -110,6 +110,7 @@ namespace build2
// Diagnostic facility, base infrastructure.
//
+ using butl::diag_lock;
using butl::diag_stream;
using butl::diag_epilogue;
diff --git a/build2/dump.cxx b/build2/dump.cxx
index 7055a78..6d055ae 100644
--- a/build2/dump.cxx
+++ b/build2/dump.cxx
@@ -345,6 +345,9 @@ namespace build2
auto i (scopes.cbegin ());
assert (&i->second == global_scope);
+ // We don't lock diag_stream here as dump() is supposed to be called from
+ // the main thread prior to any other threads being spawned.
+ //
string ind;
ostream& os (*diag_stream);
dump_scope (os, ind, i);
diff --git a/build2/test/rule.cxx b/build2/test/rule.cxx
index 25eb0b8..8e39104 100644
--- a/build2/test/rule.cxx
+++ b/build2/test/rule.cxx
@@ -399,7 +399,8 @@ namespace build2
}
catch (const std::exception& e)
{
- *diag_stream << "unhandled exception: " << e;
+ diag_lock l;
+ *diag_stream << "unhandled exception: " << e << endl;
assert (false);
abort ();
}
diff --git a/build2/test/script/builtin.cxx b/build2/test/script/builtin.cxx
index d96058e..9bd6a1b 100644
--- a/build2/test/script/builtin.cxx
+++ b/build2/test/script/builtin.cxx
@@ -1361,7 +1361,8 @@ namespace build2
}
catch (const std::exception& e)
{
- *diag_stream << "unhandled exception: " << e;
+ diag_lock l;
+ *diag_stream << "unhandled exception: " << e << endl;
assert (false);
abort ();
}
diff --git a/build2/test/script/parser.cxx b/build2/test/script/parser.cxx
index 0555f2f..d6d77fe 100644
--- a/build2/test/script/parser.cxx
+++ b/build2/test/script/parser.cxx
@@ -2881,7 +2881,8 @@ namespace build2
}
catch (const std::exception& e)
{
- *diag_stream << "unhandled exception: " << e;
+ diag_lock l;
+ *diag_stream << "unhandled exception: " << e << endl;
assert (false);
abort ();
}