pthread_exit bug?

[email protected] (Paul Pluzhnikov)
Newsgroups gmane.comp.lib.phil
Message-ID <[email protected]>
Gentlemen,

According to SUSv3 (http://www.unix-systems.org/single_unix_specification),
pthread_exit() page:

  The process shall exit with an exit status of 0 after the last
  thread has been terminated. The behavior shall be as if the
  implementation called exit() with a zero argument at thread
  termination time.

As the test case below demonstrates, this doesn't appear to be happening
with NPTL 0.21 (as shipped with Phoebe3). Sources to NPTL 0.30 do not
appear to have changed in that area, so AFAICT the bug is still there.

--- cut ---
#include <pthread.h>
#include <stdlib.h>
#include <stdio.h>

void exit_handler()
{
    fprintf(stderr, "exit_handler was called\n");
}
int main()
{
    atexit(exit_handler);
    pthread_exit(0);
}
--- cut ---

On Solaris:
$ gcc -g -pthreads t.c
$ ./a.out
exit_handler was called
$

On Linux (linuxthreads, or NPTL):
$ gcc -g -pthread t.c
$ ./a.out
$ 

Regards,
-- 
Paul Pluzhnikov		[email protected]
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.