Back to index

glibc  2.9
Defines | Functions
tst-mutex6.c File Reference
#include <pthread.h>
#include <signal.h>
#include <stdio.h>
#include <unistd.h>
#include <errno.h>
#include "../test-skeleton.c"
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.


#define ATTR   NULL
#define TEST_FUNCTION   do_test ()


static int do_test (void)

Define Documentation

#define ATTR   NULL

Definition at line 28 of file tst-mutex6.c.


Definition at line 71 of file tst-mutex6.c.

#define TEST_FUNCTION   do_test ()

Definition at line 73 of file tst-mutex6.c.

Function Documentation

static int do_test ( void  ) [static]

Definition at line 33 of file tst-mutex6.c.

  pthread_mutex_t m;

  int e = pthread_mutex_init (&m, ATTR);
  if (ATTR != NULL && e == ENOTSUP)
      puts ("cannot support selected type of mutexes");
      e = pthread_mutex_init (&m, NULL);
  if (e != 0)
      puts ("mutex_init failed");
      return 1;

  if (ATTR != NULL && pthread_mutexattr_destroy (ATTR) != 0)
      puts ("mutexattr_destroy failed");
      return 1;

  if (pthread_mutex_lock (&m) != 0)
      puts ("1st mutex_lock failed");
      return 1;

  /* Set an alarm for 1 second.  The wrapper will expect this.  */
  alarm (1);

  /* This call should never return.  */
  pthread_mutex_lock (&m);

  puts ("2nd mutex_lock returned");
  return 1;

Here is the call graph for this function: