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: Karim Bernardet
Subject: Re: problem related to Thread::detach()
Date: Thu, 15 Jan 2004 09:43:54 +0100
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.5) Gecko/20030925

David Sugar wrote:

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


Thanks a lot for your help
with commoncpp2-1.1.20040101, it seems better ! (I remove the final method from my class)

Karim.

--
__________________________________________________________________________
| Karim BERNARDET                | Phone : (+33){0}4-91-82-72-33           |
| C.P.P.M.                       | Fax   : (+33){0}4-91-82-72-99           |
| 163, av. de Luminy             | Email : address@hidden         |
| Case 902                       | Web :  http://marwww.in2p3.fr/~kbernard |
| F-13288 Marseille CEDEX 09     | Bureau 349                              |
| FRANCE                         |                                         |
--------------------------------------------------------------------------






reply via email to

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