aboutsummaryrefslogtreecommitdiff
path: root/gdb/complaints.c
diff options
context:
space:
mode:
Diffstat (limited to 'gdb/complaints.c')
-rw-r--r--gdb/complaints.c20
1 files changed, 5 insertions, 15 deletions
diff --git a/gdb/complaints.c b/gdb/complaints.c
index 2f58af2..03d27d6 100644
--- a/gdb/complaints.c
+++ b/gdb/complaints.c
@@ -22,11 +22,9 @@
#include "cli/cli-cmds.h"
#include "run-on-main-thread.h"
#include "top.h"
+#include "gdbsupport/cxx-thread.h"
#include "gdbsupport/selftest.h"
#include "gdbsupport/unordered_map.h"
-#if CXX_STD_THREAD
-#include <mutex>
-#endif
/* Map format strings to counters. */
@@ -38,9 +36,7 @@ static gdb::unordered_map<const char *, int> counters;
int stop_whining = 0;
-#if CXX_STD_THREAD
-static std::mutex complaint_mutex;
-#endif /* CXX_STD_THREAD */
+static gdb::mutex complaint_mutex;
/* See complaints.h. */
@@ -50,9 +46,7 @@ complaint_internal (const char *fmt, ...)
va_list args;
{
-#if CXX_STD_THREAD
- std::lock_guard<std::mutex> guard (complaint_mutex);
-#endif
+ gdb::lock_guard<gdb::mutex> guard (complaint_mutex);
if (++counters[fmt] > stop_whining)
return;
}
@@ -126,9 +120,7 @@ re_emit_complaints (const complaint_collection &complaints)
void
complaint_interceptor::warn (const char *fmt, va_list args)
{
-#if CXX_STD_THREAD
- std::lock_guard<std::mutex> guard (complaint_mutex);
-#endif
+ gdb::lock_guard<gdb::mutex> guard (complaint_mutex);
g_complaint_interceptor->m_complaints.insert (string_vprintf (fmt, args));
}
@@ -188,9 +180,7 @@ test_complaints ()
} /* namespace selftests */
#endif /* GDB_SELF_TEST */
-void _initialize_complaints ();
-void
-_initialize_complaints ()
+INIT_GDB_FILE (complaints)
{
add_setshow_zinteger_cmd ("complaints", class_support,
&stop_whining, _("\