Back to index

glibc  2.9
Defines | Functions | Variables
tst-tsd5.c File Reference
#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 cl (void *p)
static void * tf (void *arg)
static int do_test (void)

Variables

static pthread_mutex_t m = PTHREAD_MUTEX_INITIALIZER

Define Documentation

#define TEST_FUNCTION   do_test ()

Definition at line 80 of file tst-tsd5.c.


Function Documentation

static void cl ( void *  p) [static]

Definition at line 29 of file tst-tsd5.c.

Here is the call graph for this function:

Here is the caller graph for this function:

static int do_test ( void  ) [static]

Definition at line 49 of file tst-tsd5.c.

{
  pthread_key_t k;
  if (pthread_key_create (&k, cl) != 0)
    {
      puts ("key_create failed");
      return 1;
    }
  if (pthread_setspecific (k, (void *) 1) != 0)
    {
      puts ("setspecific failed");
      return 1;
    }

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

  pthread_t th;
  if (pthread_create (&th, NULL, tf, NULL) != 0)
    {
      puts ("create failed");
      return 1;
    }

  pthread_exit (NULL);
}

Here is the call graph for this function:

static void* tf ( void *  arg) [static]

Definition at line 36 of file tst-tsd5.c.

{
  if (pthread_mutex_lock (&m) != 0)
    {
      puts ("2nd mutex_lock failed");
      exit (1);
    }

  exit (0);
}

Here is the call graph for this function:


Variable Documentation

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