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