diff options
author | Jakub Jelinek <jakub@redhat.com> | 2007-07-12 18:26:36 +0000 |
---|---|---|
committer | Jakub Jelinek <jakub@redhat.com> | 2007-07-12 18:26:36 +0000 |
commit | 0ecb606cb6cf65de1d9fc8a919bceb4be476c602 (patch) | |
tree | 2ea1f8305970753e4a657acb2ccc15ca3eec8e2c /linuxthreads/Examples/ex7.c | |
parent | 7d58530341304d403a6626d7f7a1913165fe2f32 (diff) | |
download | glibc-0ecb606cb6cf65de1d9fc8a919bceb4be476c602.tar.gz glibc-0ecb606cb6cf65de1d9fc8a919bceb4be476c602.tar.xz glibc-0ecb606cb6cf65de1d9fc8a919bceb4be476c602.zip |
2.5-18.1
Diffstat (limited to 'linuxthreads/Examples/ex7.c')
-rw-r--r-- | linuxthreads/Examples/ex7.c | 45 |
1 files changed, 0 insertions, 45 deletions
diff --git a/linuxthreads/Examples/ex7.c b/linuxthreads/Examples/ex7.c deleted file mode 100644 index d9db33c5cd..0000000000 --- a/linuxthreads/Examples/ex7.c +++ /dev/null @@ -1,45 +0,0 @@ -/* This is a test of the special shutdown that occurs - when all threads, including the main one, call - pthread_exit(). It demonstrates that atexit - handlers are properly called, and that the - output is properly flushed even when stdout is - redirected to a file, and therefore fully buffered. */ - -#include <stdio.h> -#include <stdlib.h> -#include <pthread.h> - -#define NTHREADS 20 /* number of threads */ - -static void * -thread (void *arg) -{ - printf ("thread terminating\n"); - return 0; -} - -static void -cleanup (void) -{ - printf ("atexit handler called\n"); -} - -int -main (void) -{ - 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); -} |