Back to index

glibc  2.9
Defines | Functions
tst-dlsym1.c File Reference
#include <dlfcn.h>
#include <pthread.h>
#include <stdio.h>
#include <stdlib.h>
#include "../test-skeleton.c"

Go to the source code of this file.

Defines

#define TEST_FUNCTION   do_test ()

Functions

static void * start_routine (void *args)
static int do_test (void)

Define Documentation

#define TEST_FUNCTION   do_test ()

Definition at line 65 of file tst-dlsym1.c.


Function Documentation

static int do_test ( void  ) [static]

Definition at line 21 of file tst-dlsym1.c.

{
  pthread_t tid1, tid2, tid3;

  void *addrs1[1024];
  void *addrs2[1024];
  void *addrs3[1024];

  if (pthread_create (&tid1, NULL, start_routine, addrs1) != 0)
    {
      puts ("1st create failed");
      exit (1);
    }
  if (pthread_create (&tid2, NULL, start_routine, addrs2) != 0)
    {
      puts ("2nd create failed");
      exit (1);
    }
  if (pthread_create (&tid3, NULL, start_routine, addrs3) != 0)
    {
      puts ("3rd create failed");
      exit (1);
    }

  if (pthread_join (tid1, NULL) != 0)
    {
      puts ("1st join failed");
      exit (1);
    }
  if (pthread_join (tid2, NULL) != 0)
    {
      puts ("2nd join failed");
      exit (1);
    }
  if (pthread_join (tid3, NULL) != 0)
    {
      puts ("2rd join failed");
      exit (1);
    }

  return 0;
}

Here is the call graph for this function:

static void* start_routine ( void *  args) [static]

Definition at line 9 of file tst-dlsym1.c.

{
  int i;
  void **addrs = (void **) args;
  for (i = 0; i < 10000; ++i)
    addrs[i % 1024] = dlsym (NULL, "does_not_exist");

  return addrs;
}

Here is the call graph for this function: