summaryrefslogtreecommitdiffstats
path: root/vespalib/src/tests/signalhandler/my_shared_library.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'vespalib/src/tests/signalhandler/my_shared_library.cpp')
-rw-r--r--vespalib/src/tests/signalhandler/my_shared_library.cpp20
1 files changed, 20 insertions, 0 deletions
diff --git a/vespalib/src/tests/signalhandler/my_shared_library.cpp b/vespalib/src/tests/signalhandler/my_shared_library.cpp
new file mode 100644
index 00000000000..4b7593d863c
--- /dev/null
+++ b/vespalib/src/tests/signalhandler/my_shared_library.cpp
@@ -0,0 +1,20 @@
+// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
+
+#include "my_shared_library.h"
+#include <vespa/vespalib/util/signalhandler.h>
+
+// This tiny library exists solely as a way to ensure we get visible function names in our backtrace,
+// as that is not necessarily the case for statically linked functions.
+
+// Could have used a single std::barrier<no op functor> here, but when using explicit
+// phase latches it sort of feels like the semantics are more immediately obvious.
+void my_cool_function(std::latch& arrival_latch, std::latch& departure_latch) {
+ arrival_latch.arrive_and_wait();
+ // Twiddle thumbs in departure latch until main test thread has dumped our stack
+ departure_latch.arrive_and_wait();
+ asm(""); // Dear GCC; really, really don't inline this function. It's clobberin' time!
+}
+
+vespalib::string my_totally_tubular_and_groovy_function() {
+ return vespalib::SignalHandler::get_cross_thread_stack_trace(pthread_self());
+}