math/test-fenvinline: Cast fe_exc to unsigned int before printing
[glibc.git] / elf / tst-thrlock.c
blobfe72eba141e47f20a59efe598abe9d5769e16be4
1 #include <dlfcn.h>
2 #include <pthread.h>
3 #include <stdio.h>
4 #include <stdlib.h>
5 #include <string.h>
6 #include <gnu/lib-names.h>
8 static void *
9 tf (void *arg)
11 void *h = dlopen (LIBM_SO, RTLD_LAZY);
12 if (h == NULL)
14 printf ("dlopen failed: %s\n", dlerror ());
15 exit (1);
17 if (dlsym (h, "sin") == NULL)
19 printf ("dlsym failed: %s\n", dlerror ());
20 exit (1);
22 if (dlclose (h) != 0)
24 printf ("dlclose failed: %s\n", dlerror ());
25 exit (1);
27 return NULL;
31 static int
32 do_test (void)
34 #define N 10
35 pthread_t th[N];
36 for (int i = 0; i < N; ++i)
38 int e = pthread_create (&th[i], NULL, tf, NULL);
39 if (e != 0)
41 printf ("pthread_create failed with %d (%s)\n", e, strerror (e));
42 return 1;
45 for (int i = 0; i < N; ++i)
47 void *res;
48 int e = pthread_join (th[i], &res);
49 if (e != 0 || res != NULL)
51 puts ("thread failed");
52 return 1;
55 return 0;
58 #define TEST_FUNCTION do_test ()
59 #include "../test-skeleton.c"