Back to index

glibc  2.9
Functions
bug-sleep.c File Reference
#include <pthread.h>
#include <stdio.h>
#include <unistd.h>
#include <time.h>

Go to the source code of this file.

Functions

void * run_thread (void *a)
int main (void)

Function Documentation

int main ( void  )

Definition at line 18 of file bug-sleep.c.

{
  pthread_t thr;
  void *result;
  alarm (4);
  printf ("Starting thread.\n");
  pthread_create (&thr, 0, run_thread, 0);
  sleep (2);
  printf ("Canceling thread.\n");
  pthread_cancel (thr);
  pthread_join (thr, &result);
  if (result == PTHREAD_CANCELED)
    printf ("Thread canceled.\n");
  else
    printf ("Thread exited.\n");
  return 0;
}

Here is the call graph for this function:

void* run_thread ( void *  a)

Definition at line 8 of file bug-sleep.c.

{
  while (1)
    {
      sleep (10);
    }
  return 0;
}

Here is the call graph for this function:

Here is the caller graph for this function: