diff options
author | Roland McGrath <roland@gnu.org> | 2005-07-03 04:40:34 +0000 |
---|---|---|
committer | Roland McGrath <roland@gnu.org> | 2005-07-03 04:40:34 +0000 |
commit | 88e3fbcb5d6829f8980d6bb356b1c0cd7a38187b (patch) | |
tree | 41b73f55c91439f87d82e5d32b9d8e46e82ce3c1 /linuxthreads/Examples/ex7.c | |
parent | d19b1b4f2ff49e085b55e8564b52ca17b028e335 (diff) | |
download | glibc-88e3fbcb5d6829f8980d6bb356b1c0cd7a38187b.zip glibc-88e3fbcb5d6829f8980d6bb356b1c0cd7a38187b.tar.gz glibc-88e3fbcb5d6829f8980d6bb356b1c0cd7a38187b.tar.bz2 |
linuxthreads, linuxthreads_db: Directories removed (preserved in ports repository).
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 d9db33c..0000000 --- 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); -} |