bug-commoncpp
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: problem related to Thread::detach()


From: David Sugar
Subject: Re: problem related to Thread::detach()
Date: Wed, 14 Jan 2004 07:41:44 -0500

I believe this issue has been resolved best in the pending 1.1 release;
essentially detached threads will get deleted for you when they call
exit (this is new behavior).  But I will have to see if we come up with
a workaround for 1.0.x releases...

On Wed, 2004-01-14 at 05:58, Karim Bernardet wrote:
> Hello,
> 
> I use commoncpp2-1.0.13 to create detached thread like this
> 
> command *process2 = new 
> command(messageFromServer[1],messageFromServer[2],messageFromServer[3],SERV);
> 
>                if (!process2)
>              {
>                *messages << MSG::ERROR << "main:: Failed to create a new 
> thread command "  << endreq;
>                exit(0);
>              }
>                else
>                   {
> process2->detach();
>              process2->start();
> }
> 
> But the program crashes:
> Reading symbols from /lib/libnss_files.so.2...done.
> Loaded symbols for /lib/libnss_files.so.2
> #0  0x08067073 in ost::Thread::detach(ost::Semaphore*) (this=0x80a1960,
>     start=0x0) at thread.cpp:729
> 729             if(!rtn && priv->_tid)
> (gdb)
> 
> 
> 
> If I comment "delete this" in the final() method, it "works" but with a 
> memory leak
> 
> void command::final()
> {
>    message << MSG::DEBUG << "command::final()" << endreq;
>    // delete this;
> }
> 
> If someone have an idea ...
> 
> Thanks a lot
> 
> Karim
> 
> 
> 
> _______________________________________________
> Bug-commoncpp mailing list
> address@hidden
> http://mail.gnu.org/mailman/listinfo/bug-commoncpp





reply via email to

[Prev in Thread] Current Thread [Next in Thread]