Skip to content

Commit 76b0b8b

Browse files
committed
Put report_error() back in a mutex
We may no longer need to wrap the ostream operations, but we still need to wrap the test for whether report_error() is being called recursively. Trying to just never call report_error() recursively would be doable for the moment (the asserts inside `on_command_line` tests in `print_trace` seem to be the only code path that can currently do it), but I don't see a way to future proof that - we like to do lots of helpful things when error reporting, and we like to fill the things we do with assertions.
1 parent e262dde commit 76b0b8b

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

include/base/libmesh_common.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -390,7 +390,9 @@ struct casting_compare {
390390
do { \
391391
std::stringstream message_stream; \
392392
message_stream << msg << '\n'; \
393+
libMesh::Threads::lock_singleton_spin_mutex(); \
393394
libMesh::MacroFunctions::report_error(__FILE__, __LINE__, LIBMESH_DATE, LIBMESH_TIME, message_stream); \
395+
libMesh::Threads::unlock_singleton_spin_mutex(); \
394396
LIBMESH_THROW(libMesh::LogicError(message_stream.str())); \
395397
} while (0)
396398

@@ -418,7 +420,9 @@ struct casting_compare {
418420
do { \
419421
std::stringstream message_stream; \
420422
message_stream << msg << '\n'; \
423+
libMesh::Threads::lock_singleton_spin_mutex(); \
421424
libMesh::MacroFunctions::report_error(__FILE__, __LINE__, LIBMESH_DATE, LIBMESH_TIME, message_stream); \
425+
libMesh::Threads::unlock_singleton_spin_mutex(); \
422426
LIBMESH_THROW(libMesh::NotImplemented(message_stream.str())); \
423427
} while (0)
424428

@@ -428,7 +432,9 @@ struct casting_compare {
428432
do { \
429433
std::stringstream message_stream; \
430434
message_stream << msg << '\n'; \
435+
libMesh::Threads::lock_singleton_spin_mutex(); \
431436
libMesh::MacroFunctions::report_error(__FILE__, __LINE__, LIBMESH_DATE, LIBMESH_TIME, message_stream); \
437+
libMesh::Threads::unlock_singleton_spin_mutex(); \
432438
LIBMESH_THROW(libMesh::FileError(filename, message_stream.str())); \
433439
} while (0)
434440

0 commit comments

Comments
 (0)