[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: pthread creates one extra thread
On Mon, 2004-01-05 at 19:45, Jan Krause wrote:
> 1. Whats the difference between original and master thread?
>
> 2. I only see 2 threads started, namely the main thread ( void main () ) and the
> one created with pthread_create... but if this thread immediately exits
> as you said, there should only be 1 left: the main () thread, but thats not the case.
>
> Where is my fault?
You need to call pthread_join(3) from the parent on the child thread or
create the thread with PTHREAD_CREATE_DETACHED or call pthread_detach(3)
from the child thread.
This is basic POSIX thread behavior and not a kernel issue.
Rob Love
--
Kernelnewbies: Help each other learn about the Linux kernel.
Archive: http://mail.nl.linux.org/kernelnewbies/
FAQ: http://kernelnewbies.org/faq/