bug-commoncpp
[Top][All Lists]
Advanced

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

problem related to Thread::detach()


From: Karim Bernardet
Subject: problem related to Thread::detach()
Date: Wed, 14 Jan 2004 11:58:26 +0100
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.5) Gecko/20030925

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





reply via email to

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