Back to index

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

Go to the source code of this file.

Defines

#define TEST_FUNCTION   do_test ()

Functions

static int do_test (void)

Define Documentation

#define TEST_FUNCTION   do_test ()

Definition at line 70 of file tst-rwlock13.c.


Function Documentation

static int do_test ( void  ) [static]

Definition at line 25 of file tst-rwlock13.c.

{
  pthread_rwlock_t r;
  int ret;

  memset (&r, 0xaa, sizeof (r));
  if ((ret = pthread_rwlock_init (&r, NULL)) != 0)
    {
      printf ("rwlock_init failed: %d\n", ret);
      return 1;
    }

  if ((ret = pthread_rwlock_rdlock (&r)) != 0)
    {
      printf ("rwlock_rdlock failed: %d\n", ret);
      return 1;
    }

  if ((ret = pthread_rwlock_unlock (&r)) != 0)
    {
      printf ("rwlock_unlock failed: %d\n", ret);
      return 1;
    }

  if ((ret = pthread_rwlock_wrlock (&r)) != 0)
    {
      printf ("rwlock_wrlock failed: %d\n", ret);
      return 1;
    }

  if ((ret = pthread_rwlock_unlock (&r)) != 0)
    {
      printf ("second rwlock_unlock failed: %d\n", ret);
      return 1;
    }

  if ((ret = pthread_rwlock_destroy (&r)) != 0)
    {
      printf ("second rwlock_destroy failed: %d\n", ret);
      return 1;
    }

  return 0;
}

Here is the call graph for this function: