[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

pthread_exit bug?



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		paul parasoft com





[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]