This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Destructor never gets called.
- To: "Liu, Guangsheng" <guangsheng dot liu at intel dot com>
- Subject: Re: Destructor never gets called.
- From: Alexandre Oliva <aoliva at redhat dot com>
- Date: 12 Jun 2001 20:49:38 -0300
- Cc: "'gcc at gcc dot gnu dot org'" <gcc at gcc dot gnu dot org>
- Organization: GCC Team, Red Hat
- References: <6B0F0A1F0F44D1118BB000A024620EB50A58AA81@exchange2nj.dialogic.com>
On Jun 11, 2001, "Liu, Guangsheng" <guangsheng.liu@intel.com> wrote:
> pthread_exit() exits itself. After all the threads exit (t1, t2,
> main thread), I didn't see Class A's destructor being called.
pthread_exit() is not guaranteed to unwind the stack of the thread, so
destructors aren't called. It only calls cleanup handlers, but
destructors of automatic objects aren't registered as such. It's
debatable whether they should.
--
Alexandre Oliva Enjoy Guarana', see http://www.ic.unicamp.br/~oliva/
Red Hat GCC Developer aoliva@{cygnus.com, redhat.com}
CS PhD student at IC-Unicamp oliva@{lsd.ic.unicamp.br, gnu.org}
Free Software Evangelist *Please* write to mailing lists, not to me