File: pth_create_glibc_2_0.c

package info (click to toggle)
valgrind 1%3A3.14.0-3
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 156,980 kB
  • sloc: ansic: 728,128; exp: 26,134; xml: 22,268; cpp: 7,638; asm: 7,312; makefile: 6,102; perl: 5,910; sh: 5,717
file content (39 lines) | stat: -rw-r--r-- 809 bytes parent folder | download | duplicates (9)
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
35
36
37
38
39
/*
 * Test program that invokes pthread_create@GLIBC_2.0().
 *
 * Note: pthread_create@GLIBC_2.0() is only available in 32-bit glibc versions,
 * not in 64-bit versions.
 */


#include <pthread.h>
#include <stdio.h>


extern int pthread_create_glibc_2_0(pthread_t*, const pthread_attr_t*,
                                    void *(*)(void*), void*);

__asm__(".symver pthread_create_glibc_2_0, pthread_create@GLIBC_2.0");


static void* thread_func(void *arg)
{
  fprintf(stderr, "The thread.\n");
  return 0;
}

int main(int argc, char** argv)
{
  int result;
  pthread_t thr;

  result = (*pthread_create_glibc_2_0)(&thr, 0, thread_func, 0);
  if (result != 0)
  {
    fprintf(stderr, "pthread_create() failed.\n");
    return 1;
  }
  pthread_join(thr, 0);
  fprintf(stderr, "Finished.\n");
  return 0;
}