- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - Linux
- >
- Re: Doubt with pthread_exit
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Forums
Discussions
Discussions
Discussions
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-30-2007 06:24 PM
10-30-2007 06:24 PM
Doubt with pthread_exit
Is there way to know whether pthread_exit is called.
In c++ we can have a print statement in destructor function, which shows that destructor is called when an object is getting out.
- Tags:
- pthread
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-31-2007 12:54 PM - edited 09-18-2011 02:54 PM
10-31-2007 12:54 PM - edited 09-18-2011 02:54 PM
Re: Question on pthread_exit
>In C++ we can have a print statement in destructor function, which shows that destructor is called when an object is getting out.
There is no connection between destructors and threads.
If you call pthread_exit, the destructors for any local objects will not be called. (At least on IPF.)
Since you are returning from the start function that already calls the destructors for any locals.
If you want to know if pthread_exit is called, put a breakpoint there.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-01-2007 09:21 PM
11-01-2007 09:21 PM
Re: Doubt with pthread_exit
I'm not using an explicit call to pthread_exit, so i think i can't able to put a breakpoint.
>If you call pthread_exit, the destructors for any local objects will not be called.
If there is no explicit call to pthread_exit, will it lead to memory leak.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-02-2007 04:27 PM - edited 09-18-2011 02:55 PM
11-02-2007 04:27 PM - edited 09-18-2011 02:55 PM
Re: Question on pthread_exit
>I'm not using an explicit call to pthread_exit, so I think I can't able to put a breakpoint.
No, you can still set a breakpoint there to see who else calls it. In my case I'm just returning out of the start routine:
(gdb) bt
#0 0x2000000076ef1a30:2 pthread_exit+0x72 /usr/lib/hpux32/libpthread.so.1
#1 0x2000000076ef04c0:0 __pthread_bound_body+0x190 libpthread.so.1
So libpthread automatically calls it.
>If there is no explicit call to pthread_exit, will it lead to memory leak.
No, you may leak memory if you don't return/throw back to your start routine.
Especially if you have locals that are STL containers. See:
http://docs.hp.com/en/10946/threads.htm
Pthreads (Posix Threads) Limitations
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-02-2007 10:19 PM
11-02-2007 10:19 PM