Back to index

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

Go to the source code of this file.

Defines

#define TEST_FUNCTION   do_test ()

Functions

static void * tf (void *p)
static int do_test (void)

Variables

static int seen

Define Documentation

#define TEST_FUNCTION   do_test ()

Definition at line 78 of file tst-stack2.c.


Function Documentation

static int do_test ( void  ) [static]

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

{
  pthread_attr_t attr;
  pthread_attr_init (&attr);

  int result = 0;
  int res = pthread_attr_setstacksize (&attr, PTHREAD_STACK_MIN);
  if (res)
    {
      printf ("pthread_attr_setstacksize failed %d\n", res);
      result = 1;
    }

  /* Create the thread.  */
  pthread_t th;
  res = pthread_create (&th, &attr, tf, NULL);
  if (res)
    {
      printf ("pthread_create failed %d\n", res);
      result = 1;
    }
  else
    {
      res = pthread_join (th, NULL);
      if (res)
       {
         printf ("pthread_join failed %d\n", res);
         result = 1;
       }
    }

  if (seen != 1)
    {
      printf ("seen %d != 1\n", seen);
      result = 1;
    }

  return result;
}

Here is the call graph for this function:

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

Definition at line 30 of file tst-stack2.c.

{
  ++seen;
  return NULL;
}

Variable Documentation

int seen [static]

Definition at line 27 of file tst-stack2.c.