pthread_exit behavior from main

Paul Pluzhnikov ppluzhnikov@google.com
Fri Oct 5 01:14:00 GMT 2012


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



More information about the Libc-help mailing list