This is the mail archive of the
glibc-linux@ricardo.ecn.wfu.edu
mailing list for the glibc project.
Bug in pthread_exit()
- To: glibc-linux at ricardo dot ecn dot wfu dot edu
- Subject: Bug in pthread_exit()
- From: kd at flaga dot is
- Date: Thu, 16 Dec 1999 16:35:31 +0000
- Reply-To: glibc-linux at ricardo dot ecn dot wfu dot edu
Hi,
I have glibc-2.1.2 with Kaz patch (posted here a couple a days ago) applied
and my own clearing of the pthread_descr_struct in pthread_allocate_stack()
(in file manager.c)
instead of the memset() function call (that does nothing but hang when
called from pthread_allocate_stack)
The kernel is 2.2.5 adapted for embedded target MPC823. The compiler is
gcc2-95.2 (C and C++ frontends).
pthread_exit has the following implementation:
void weak_function pthread_exit(void* retval)
{
exit(EXIT_SUCCESS);
}
When exit(EXIT_SUCCESS) is called (because one thread is exiting and calls
pthread_exit()) the whole process is terminated, which is according to the
documentation of exit(3).
But pthread_exit() should only terminate the thread that is exiting.
If I comment out the call to exit every thing runs fine, but does that not
imply that cleaning up after the thread that just existed is skipped, hence
causing a memory leak?
The threads are created in DETACHED state. If threads are created JOINABLE
everything runs fine.
K.D.