Thanks a lot for the example, I tried it out, but I had following error:

timedswitchobject.cpp(55): warning #167: argument of type "osg::Thread *" is
incompatible with parameter of type "osg::BaseThreadCommonBase::ThreadFuncF"
   thread->runFunction(thread, 0, NULL);

My relvant code is:

void TimedSwitchObject::thread(void* s)
{
        OSG::osgsleep(m_timeout);

        slotTimeout();
}

void TimedSwitchObject::interact()
{
        SwitchObject::interact();

        // start thread
        OSG::Thread* thread;
        
        if (OSG::Thread::find("MyThread") == NULL)
                thread = OSG::Thread::get("testfrompeter");

        thread->runFunction(thread, 0, NULL);
}

void TimedSwitchObject::slotTimeout()
{
        SwitchObject::interact();
}

Do you have an idea what might be wrong?

Thanks,

Peter

> -----Original Message-----
> From: [EMAIL PROTECTED] [mailto:opensg-users-
> [EMAIL PROTECTED] On Behalf Of Andreas Zieringer
> Sent: donderdag 11 maart 2004 23:21
> To: [email protected]
> Subject: Re: [Opensg-users] concerning last message (OpenSG and
> QT/QThread/QTimer)
> 
> Hi Peter,
> 
> a small thread example.
> 
> Hope it helps,
> 
> Andreas
> 
> 
> void mythread(void *s)
> {
>       // do something
>       _is_running = false;
> }
> 
> Thread _thread = NULL;
> 
> ...
> 
> if(OSG::Thread::find("MyThread") == NULL)
>       _thread = OSG::Thread::get("MyThread");
> 
> _is_running = true;
> _thread->runFunction(mythread, 0, NULL);
> 
> while(_is_running)
> {
>       // do something
>       osgsleep(100);
> }
> Thread::join(_thread);
> 
> 
> > Hi
> >
> > Is it possible to create self-defined threads with OpenSG? I only needed
> QT
> > for the QThread and/or QTimer-classes, so if creating threads is also
> > possible in OpenSG, then I don't need QT anymore, and the problem is
> > automagically fixed ;)
> >
> > I noticed there is a OSG::OSGThread-class, but I'm not familiar with
> that
> > class, so it might only work on internal code.
> >
> > Thanks,
> >
> > --
> > Peter
> >
> >
> >
> > -------------------------------------------------------
> > This SF.Net email is sponsored by: IBM Linux Tutorials
> > Free Linux tutorial presented by Daniel Robbins, President and CEO of
> > GenToo technologies. Learn everything from fundamentals to system
> > administration.http://ads.osdn.com/?ad_id=1470&alloc_id=3638&op=click
> > _______________________________________________
> > Opensg-users mailing list
> > [email protected]
> > https://lists.sourceforge.net/lists/listinfo/opensg-users
> >
> >
> 
> 
> 
> 
> -------------------------------------------------------
> This SF.Net email is sponsored by: IBM Linux Tutorials
> Free Linux tutorial presented by Daniel Robbins, President and CEO of
> GenToo technologies. Learn everything from fundamentals to system
> administration.http://ads.osdn.com/?ad_id=1470&alloc_id=3638&op=click
> _______________________________________________
> Opensg-users mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/opensg-users



-------------------------------------------------------
This SF.Net email is sponsored by: IBM Linux Tutorials
Free Linux tutorial presented by Daniel Robbins, President and CEO of
GenToo technologies. Learn everything from fundamentals to system
administration.http://ads.osdn.com/?ad_id=1470&alloc_id=3638&op=click
_______________________________________________
Opensg-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/opensg-users

Reply via email to