Results 1 to 2 of 2
Hi,
I am bit confused with pthread_exit, join & detach.
I call pthread_create from one thread and then in next line I do pthread_join of newly created thread id. In ...
- 10-21-2008 #1Just Joined!
- Join Date
- Dec 2007
- Posts
- 28
pthread_exit
Hi,
I am bit confused with pthread_exit, join & detach.
I call pthread_create from one thread and then in next line I do pthread_join of newly created thread id. In this case can I do pthread_exit in the newly created thread?
I believe if we do pthread_exit, the thread will be distroyed as well as its memory associated with it will be freed. Is my understanding correct?
Thanks in Advance!!
- 10-21-2008 #2
As far as I know, you don't really need to use pthread_exit actually. Coz if the thread exit by itself, its already free the memory. We use pthread_exit just like we use exit() in normal program, to exit in the middle of program.
In order to exit from the newly created thread, you must put the pthread_exit in the thread routine.


Reply With Quote