1/* $FreeBSD$ */ 2/* Test stack unwinding for libc's sem */ 3 4#include <pthread.h> 5#include <stdio.h> 6#include <semaphore.h> 7#include <unistd.h> 8 9#include "Test.cpp" 10 11sem_t sem; 12 13void * 14thr(void *arg) 15{ 16 Test t; 17 18 sem_wait(&sem); 19 printf("Bug, thread shouldn't be here.\n"); 20 return (0); 21} 22 23int 24main() 25{ 26 pthread_t td; 27 28 sem_init(&sem, 0, 0); 29 pthread_create(&td, NULL, thr, NULL); 30 sleep(1); 31 pthread_cancel(td); 32 pthread_join(td, NULL); 33 check_destruct(); 34 return (0); 35} 36