This is the mail archive of the
libc-alpha@sourceware.cygnus.com
mailing list for the glibc project.
New LinuxThreads bug, I think
- To: libc-alpha Mailinglist <libc-alpha at sourceware dot cygnus dot com>
- Subject: New LinuxThreads bug, I think
- From: Kaz Kylheku <kaz at ashi dot footprints dot net>
- Date: Wed, 26 Apr 2000 22:15:53 -0700 (PDT)
The Single UNIX Spec says that when all threads call pthread_exit()
the process terminates as if it called exit(0).
This means that atexit functions are called, and stdio buffers are flushed.
LinuxThreads does not do this. For example, the unflushed stdout output of a
test program whose threads call pthread_exit() is simply discarded!
This only becomes apparent when you redirect the output of such a program
to a file, because stdout is then fully buffered rather than line buffered.
I'm working on a related part of the library and I just noticed that my
new test program creates a zero length .out file, but when run interactively,
produces the correct output!
The cause is that all threads simply call _exit(0).
Anyway, I will fix this as part of the shutdown-related work I'm already doing
and make it into one patch.