aboutsummaryrefslogtreecommitdiff
path: root/example/recurse2.c
diff options
context:
space:
mode:
Diffstat (limited to 'example/recurse2.c')
-rw-r--r--example/recurse2.c26
1 files changed, 26 insertions, 0 deletions
diff --git a/example/recurse2.c b/example/recurse2.c
new file mode 100644
index 0000000..1fe1c4d
--- /dev/null
+++ b/example/recurse2.c
@@ -0,0 +1,26 @@
+#include <pthread.h>
+
+// Stack overflow on different thread.
+
+void qux();
+
+void foo() {
+ qux();
+}
+void bar() {
+ foo();
+}
+void qux() {
+ bar();
+}
+
+void* thread(void*) {
+ foo();
+ return 0;
+}
+
+int main() {
+ pthread_t th;
+ pthread_create(&th, NULL, thread, NULL);
+ pthread_join(th, NULL);
+}