xref: /freebsd/tools/regression/pthread/unwind/thread_normal_exit.cpp (revision 22cf89c938886d14f5796fc49f9f020c23ea8eaf)
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 *
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
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