Home | History | Annotate | Download | only in tests
      1 /*
      2  * Test program that invokes pthread_create (at) GLIBC_2.0().
      3  *
      4  * Note: pthread_create (at) GLIBC_2.0() is only available in 32-bit glibc versions,
      5  * not in 64-bit versions.
      6  */
      7 
      8 
      9 #include <pthread.h>
     10 #include <stdio.h>
     11 
     12 
     13 extern int pthread_create_glibc_2_0(pthread_t*, const pthread_attr_t*,
     14                                     void *(*)(void*), void*);
     15 
     16 __asm__(".symver pthread_create_glibc_2_0, pthread_create (at) GLIBC_2.0");
     17 
     18 
     19 static void* thread_func(void *arg)
     20 {
     21   fprintf(stderr, "The thread.\n");
     22   return 0;
     23 }
     24 
     25 int main(int argc, char** argv)
     26 {
     27   int result;
     28   pthread_t thr;
     29 
     30   result = (*pthread_create_glibc_2_0)(&thr, 0, thread_func, 0);
     31   if (result != 0)
     32   {
     33     fprintf(stderr, "pthread_create() failed.\n");
     34     return 1;
     35   }
     36   pthread_join(thr, 0);
     37   fprintf(stderr, "Finished.\n");
     38   return 0;
     39 }
     40