Hi Ralph,

I took the time to convert my program to call beginthreadex instead of
CreateThread, but the bug stay the same.

I think it's because of my PeekMessage loop because it's the only difference
between the MFC sample and my corresponding part of code.

I think I'm gonna keep my derived class from AnimationPathManipulator
calling osg::Timer::instance()->time_s() instead of ea.getTime(), because I
don't see any other solution.


2009/1/19 Ralph Kern <[email protected]>

> Hi Alexandre,
>
> I haven't dug in deeply in your problem, but I guess it stems from the
> following remark from the CreateThread() documentation:
>
> > A thread that uses functions from the C run-time libraries should use the
> beginthread and endthread C run-time functions for thread management rather
> than CreateThread and ExitThread. Failure to do so results in small memory
> leaks when ExitThread is called.
> >
>
> This in fact means you cannot reliably use any function in your thread
> which might call a c run time lib function.
>
> Try to rewrite your thread initialization to use _beginthread instead.
>
> regards Ralph
>
> Alexandre Amalric schrieb:
> > Hi osg-users,
> >
> > I'm developping an application under MFC and I started from the MFC
> > sample to begin with but with a little difference in thread management.
> >
> > My rendering thread isn't create with _beginthread but with CreateThread
> > wich launch a CWinThread derived class with a message pump, I want it to
> > be a UI thread and not a worker thread.
> >
> > So I don't know if I'm clear but my problem is that when I play a path
> > and I press 'p' key to pause, the camera isn't at the correct position.
> > In fact I decided to derive osgGA::AnimationPathManipulator class and to
> > replace all ea.getTime() by fTimeSec ( double fTimeSec =
> > osg::Timer::instance()->time_s();) in function handle(const
> > osgGA::GUIEventAdapter& ea, osgGA::GUIActionAdapter& us);
> >
> > With this method it works perfectly, so I assume that when creating a
> > rendering thread responsible to call viewer::frame() with CreateThread
> > the ea.getTime() isn't the correct time...
> >
> > Can someone explain me why we use ea.getTime() and not
> > osg::Timer::instance()->time_s() ?
> >
> >
> > --
> > Alexandre AMALRIC                   Ingénieur R&D
> > ===================================
> > PIXXIM S.A. 73E, rue Perrin-Solliers 13006 Marseille
> > http://www.pixxim.fr
> >
>
> _______________________________________________
> osg-users mailing list
> [email protected]
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>



-- 
Alexandre AMALRIC                   Ingénieur R&D
===================================
PIXXIM S.A. 73E, rue Perrin-Solliers 13006 Marseille
http://www.pixxim.fr
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to