Back to index

glibc  2.9
Functions
tststack.c File Reference
#include <pthread.h>
#include <stdio.h>
#include <unistd.h>
#include <limits.h>
#include <sys/param.h>

Go to the source code of this file.

Functions

static void * f1 (void *)
static void * f2 (void *)
int main (void)

Function Documentation

static void * f1 ( void *  parm) [static]

Definition at line 58 of file tststack.c.

{
  printf ("This is `%s'\n", __FUNCTION__);
  fflush (stdout);

  return (void *) 1;
}

Here is the call graph for this function:

Here is the caller graph for this function:

static void * f2 ( void *  parm) [static]

Definition at line 67 of file tststack.c.

{
  printf ("This is `%s'\n", __FUNCTION__);
  fflush (stdout);
  sleep (1);

  return (void *) 2;
}

Here is the call graph for this function:

Here is the caller graph for this function:

int main ( void  )

Definition at line 30 of file tststack.c.

{
  pthread_attr_t attr;
  pthread_t th1 = 0;
  pthread_t th2 = 0;
  void *res1;
  void *res2;

  pthread_attr_init (&attr);
  if (pthread_attr_setstacksize (&attr, MAX (70*1024, PTHREAD_STACK_MIN)) != 0)
    {
      puts ("invalid stack size");
      return 1;
    }

  pthread_create (&th1, NULL, f1, NULL);
  pthread_create (&th2, &attr, f2, NULL);

  pthread_join (th1, &res1);
  pthread_join (th2, &res2);

  printf ("res1 = %p\n", res1);
  printf ("res2 = %p\n", res2);

  return res1 != (void *) 1 || res2 != (void *) 2;
}

Here is the call graph for this function: