summary refs log tree commit diff
path: root/linuxthreads/Examples/ex16.c
blob: 6509ae45152465ead85d2c2cd5794dd4026a0f1b (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
/* Tst case by Jakub Jelinek <jakub@redhat.com>.  */
#include <stdlib.h>
#include <unistd.h>
#include <pthread.h>

static void *
task (void *p)
{
  sleep (30);
  return NULL;
}

int
main (void)
{
  pthread_t t;
  int status;

  status = pthread_create (&t, NULL, task, NULL);
  if (status)
    exit (status);

  status = pthread_detach (t);
  pthread_kill_other_threads_np ();
  return status;
}