Update copyright dates with scripts/update-copyrights
[glibc.git] / nptl / tst-dlsym1.c
blob19ba8f5640ecc0a6ca054042a63b26fbf1a529e6
1 #include <dlfcn.h>
2 #include <pthread.h>
3 #include <stdio.h>
4 #include <stdlib.h>
7 static void *
8 start_routine (void *args)
10 int i;
11 void **addrs = (void **) args;
12 for (i = 0; i < 10000; ++i)
13 addrs[i % 1024] = dlsym (NULL, "does_not_exist");
15 return addrs;
19 static int
20 do_test (void)
22 pthread_t tid1, tid2, tid3;
24 void *addrs1[1024];
25 void *addrs2[1024];
26 void *addrs3[1024];
28 if (pthread_create (&tid1, NULL, start_routine, addrs1) != 0)
30 puts ("1st create failed");
31 exit (1);
33 if (pthread_create (&tid2, NULL, start_routine, addrs2) != 0)
35 puts ("2nd create failed");
36 exit (1);
38 if (pthread_create (&tid3, NULL, start_routine, addrs3) != 0)
40 puts ("3rd create failed");
41 exit (1);
44 if (pthread_join (tid1, NULL) != 0)
46 puts ("1st join failed");
47 exit (1);
49 if (pthread_join (tid2, NULL) != 0)
51 puts ("2nd join failed");
52 exit (1);
54 if (pthread_join (tid3, NULL) != 0)
56 puts ("2rd join failed");
57 exit (1);
60 return 0;
64 #define TEST_FUNCTION do_test ()
65 #include "../test-skeleton.c"