Back to index

glibc  2.9
Defines | Functions
ex7.c File Reference
#include <stdio.h>
#include <stdlib.h>
#include <pthread.h>

Go to the source code of this file.

Defines

#define NTHREADS   20 /* number of threads */

Functions

static void * thread (void *arg)
static void cleanup (void)
int main (void)

Define Documentation

#define NTHREADS   20 /* number of threads */

Definition at line 12 of file ex7.c.


Function Documentation

static void cleanup ( void  ) [static]

Definition at line 22 of file ex7.c.

{
  printf ("atexit handler called\n");
}

Here is the call graph for this function:

int main ( void  )

Definition at line 28 of file ex7.c.

{
  int i;

  atexit (cleanup);

  for (i = 0; i < NTHREADS; i++)
    {
      pthread_t id;
      if (pthread_create (&id, 0, thread, 0) != 0)
       {
         fprintf (stderr, "pthread_create failed\n");
         abort ();
       }
    }

  pthread_exit (0);
}

Here is the call graph for this function:

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

Definition at line 15 of file ex7.c.

{
  printf ("thread terminating\n");
  return 0;
}

Here is the call graph for this function:

Here is the caller graph for this function: