]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - packages/Python/lldbsuite/test/macosx/safe-to-func-call/main.c
Vendor import of lldb trunk r256945:
[FreeBSD/FreeBSD.git] / packages / Python / lldbsuite / test / macosx / safe-to-func-call / main.c
1 #include <sys/select.h>
2 #include <stdio.h>
3 #include <pthread.h>
4 #include <unistd.h>
5
6 void *
7 select_thread (void *in)
8 {
9     pthread_setname_np ("select thread");
10     fd_set fdset;
11     FD_SET (STDIN_FILENO, &fdset);
12     while (1)
13         select (2, &fdset, NULL, NULL, NULL);
14     return NULL;
15 }
16
17 void stopper ()
18 {
19     while (1)
20         sleep(1); // break here
21 }
22
23 int main ()
24 {
25     pthread_setname_np ("main thread");
26     pthread_t other_thread;
27     pthread_create (&other_thread, NULL, select_thread, NULL);
28     sleep (1);
29     stopper();
30 }