Re: Bug in JTC 1.0.14?
Brent Eagles <[email protected]> Wed, 22 Oct 2003 10:20:20 -0230
| Newsgroups | gmane.comp.lib.jtc |
|---|---|
| Organization | Object Oriented Concepts, Inc. An IONA Company |
| Message-ID | <[email protected]> |
Hi Matt,
On Tue, Sep 16, 2003 at 12:44:10PM +0100, Matt Hammond wrote:
> Wonder if anyone can shed any light on this:
>
> The example code (see below) seg-faults after a varying number of
> iterations round the for-loop in main(). However, it works fine if I
> replace the JTCThreadHandle private member with a JTCHandleT<...>
> specifically for my derived class.
>
> I'm still comparatively new at using JTC, so perhaps I'm just missing
> something really obvious? Or is this a bug? :-)
>
> If the bug doesn't manifest, try increasing the number of iterations in the
> for-loop.
>
> I'm using JTC 1.0.14, statically linked on a SUSE 7.3 Linux machine with
> GCC 2.95.3.
> cheers,
> -- start of code --
>
> #include <iostream>
> #include "JTC/JTC.h"
>
>
> class MyThread
> {
> public:
> virtual void run()
> { };
> };
>
>
> class Launcher
> {
> private:
>
> class m_Thread : public virtual JTCThread
> {
> private:
> MyThread &m_target;
>
> public:
> m_Thread(MyThread &target) : m_target(target)
> { };
>
> virtual ~m_Thread()
> { };
>
> virtual void run()
> { m_target.run(); }
> };
>
> JTCThreadHandle m_thread; // !! comment me out to stop it
> crashing
> // JTCHandleT<m_Thread> m_thread; // !! un-comment me to stop it
> crashing
>
> public:
>
> Launcher(MyThread &target)
> { m_thread = new m_Thread(target);
> m_thread->start();
> };
>
> ~Launcher()
> {
> while (m_thread->isAlive())
> try
> { m_thread->join(); }
> catch (const JTCInterruptedException &)
> { };
> };
> };
>
> int main(int, char**)
> {
> JTCInitialize init;
>
> MyThread mt;
> Launcher *lt;
>
> for(int i=0; i<10000; i++)
> {
> std::cout<<i<<endl;
> lt = new Launcher(mt);
> delete lt;
> };
>
> cout<<endl;
>
> return 0;
> };
>
>
>
> -- end of code --
I was picking through old e-mail and saw that nobody answered this (at
least on the list). I'm curious as to whether you've solved the
problem. If not and you are still interested, do you have a stack trace
to show what operation causes the core dump.
Best regards,
Brent
--
Brent Eagles
Team Orbacus - Your CORBA Source
Email: mailto:[email protected]
Phone: (709) 738-3725 x18
WWW: http://www.orbacus.com/
_______________________________________________
JTC-Users Mailing List - [email protected]
http://mail.ooc.nf.ca/mailman/listinfo/jtc-users
Visit our support FAQ before you send a message.
http://www.orbacus.com/faq/support.html