xref: /freebsd/tools/regression/pthread/unwind/thread_normal_exit.cpp (revision 2a63c3be158216222d89a073dcbd6a72ee4aab5a)
1 /* test stack unwinding for a new thread */
2 
3 #include <pthread.h>
4 #include <stdio.h>
5 #include <stdlib.h>
6 
7 #include "Test.cpp"
8 
9 static void *
thr_routine(void * arg __unused)10 thr_routine(void *arg __unused)
11 {
12 	Test test;
13 
14 	pthread_exit(NULL);
15 	printf("Bug, thread shouldn't be here\n");
16 }
17 
18 int
main()19 main()
20 {
21 	pthread_t td;
22 
23 	pthread_create(&td, NULL, thr_routine, NULL);
24 	pthread_join(td, NULL);
25 	check_destruct();
26 	return (0);
27 }
28