This is the mail archive of the
libc-help@sourceware.org
mailing list for the glibc project.
Re: pthread_exit behavior from main
- From: Paul Pluzhnikov <ppluzhnikov at google dot com>
- To: Bharath Ramesh <bramesh at vt dot edu>
- Cc: libc-help at sourceware dot org
- Date: Thu, 4 Oct 2012 18:13:51 -0700
- Subject: Re: pthread_exit behavior from main
- References: <20121004220540.GI3182@vt.edu>
On Thu, Oct 4, 2012 at 3:05 PM, Bharath Ramesh <bramesh@vt.edu> wrote:
> The manpage states "To allow other threads
> to continue execution, the main thread should terminate by
> calling pthread_exit() rather than exit(3)". Does this imply that
> main's stack will be valid till all the threads exit?
No. From "man pthread_exit":
After a thread has terminated, the result of access to local (auto)
variables of the thread is undefined.
--
Paul Pluzhnikov