Back to index

glibc  2.9
Defines | Functions | Variables
tst-mutexpp6.c File Reference
#include <pthread.h>
#include <stdio.h>
#include <stdlib.h>
#include "tst-tpp.h"
#include "tst-mutex6.c"

Go to the source code of this file.

Defines

#define PREPARE(argc, argv)   prepare ()
#define TEST_FUNCTION   do_test_wrapper ()
#define ATTR   &a

Functions

static void prepare (void)
static int do_test (void)
static int do_test_wrapper (void)

Variables

static pthread_mutexattr_t a

Define Documentation

#define ATTR   &a

Definition at line 44 of file tst-mutexpp6.c.

#define PREPARE (   argc,
  argv 
)    prepare ()

Definition at line 32 of file tst-mutexpp6.c.

#define TEST_FUNCTION   do_test_wrapper ()

Definition at line 42 of file tst-mutexpp6.c.


Function Documentation

static int do_test ( void  ) [static]

Definition at line 41 of file glrefmain.c.

{
  void *d1;
  void *d2;
  int (*f) (void);

  d1 = load ("glreflib1.so");
  d2 = load ("glreflib2.so");

  f = dlsym (d2, "ref2");
  if (f == NULL)
    error (EXIT_FAILURE, errno, "cannot get pointer to `%s'", "ref2");

  if (f () != 42)
    error (EXIT_FAILURE, 0, "wrong result from `%s'", "ref2");

  puts ("Correct result in first call");
  fflush (stdout);

  /* Now unload the first file.  */
  dlclose (d1);

  puts ("About to call the second time");
  fflush (stdout);

  /* Try calling the function again.  */
  if (f () != 42)
    error (EXIT_FAILURE, 0, "wrong result from `%s' (second call)", "ref2");

  puts ("Second call succeeded!");
  fflush (stdout);

  dlclose (d2);

  puts ("glreflib2 also closed");
  fflush (stdout);

  return 0;
}
static int do_test_wrapper ( void  ) [static]

Definition at line 37 of file tst-mutexpp6.c.

{
  init_tpp_test ();
  return do_test ();
}

Here is the call graph for this function:

static void prepare ( void  ) [static]

Definition at line 10 of file tst-mutexpp6.c.

{
  init_tpp_test ();

  if (pthread_mutexattr_init (&a) != 0)
    {
      puts ("mutexattr_init failed");
      exit (1);
    }

  if (pthread_mutexattr_setprotocol (&a, PTHREAD_PRIO_PROTECT) != 0)
    {
      puts ("mutexattr_setprotocol failed");
      exit (1);
    }

  if (pthread_mutexattr_setprioceiling (&a, 6) != 0)
    {
      puts ("mutexattr_setprioceiling failed");
      exit (1);
    }
}

Here is the call graph for this function:


Variable Documentation

Definition at line 7 of file tst-mutexpp6.c.