Back to index

glibc  2.9
Functions
ex1.c File Reference
#include <stddef.h>
#include <stdio.h>
#include <unistd.h>
#include "pthread.h"
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

static void * process (void *arg)
int main (void)

Function Documentation

int main ( void  )

Definition at line 23 of file ex1.c.

{
  int retcode;
  pthread_t th_a, th_b;
  void *retval;

  retcode = pthread_create (&th_a, NULL, process, (void *) "a");
  if (retcode != 0)
    fprintf (stderr, "create a failed %d\n", retcode);
  retcode = pthread_create (&th_b, NULL, process, (void *) "b");
  if (retcode != 0)
    fprintf (stderr, "create b failed %d\n", retcode);
  retcode = pthread_join (th_a, &retval);
  if (retcode != 0)
    fprintf (stderr, "join a failed %d\n", retcode);
  retcode = pthread_join (th_b, &retval);
  if (retcode != 0)
    fprintf (stderr, "join b failed %d\n", retcode);
  return 0;
}

Here is the call graph for this function:

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

Definition at line 11 of file ex1.c.

{
  int i;
  fprintf (stderr, "Starting process %s\n", (char *) arg);
  for (i = 0; i < 10000; i++)
    {
      write (1, (char *) arg, 1);
    }
  return NULL;
}

Here is the call graph for this function:

Here is the caller graph for this function: