aboutsummaryrefslogtreecommitdiff
path: root/example/raise2.c
diff options
context:
space:
mode:
Diffstat (limited to 'example/raise2.c')
-rw-r--r--example/raise2.c25
1 files changed, 25 insertions, 0 deletions
diff --git a/example/raise2.c b/example/raise2.c
new file mode 100644
index 0000000..056a341
--- /dev/null
+++ b/example/raise2.c
@@ -0,0 +1,25 @@
+#include <pthread.h>
+#include <signal.h>
+
+// Raise from different thread.
+
+void foo() {
+ raise(SIGSEGV);
+}
+void bar() {
+ foo();
+}
+void qux() {
+ bar();
+}
+
+void* thread(void*) {
+ qux();
+ return 0;
+}
+
+int main() {
+ pthread_t th;
+ pthread_create(&th, NULL, thread, NULL);
+ pthread_join(th, NULL);
+}