I had the same crash as you, compiling my app with visual 2005 and using the precompiled dependencies. But since I have upgraded to OSG 1.2 it seems to have disappeared. What version of OSG are you using ?
On 10/11/06, Kallfass, Daniel, SDGE1 <[EMAIL PROTECTED]> wrote:
I'm using OSG/OpenThreads/Producer that I have compiled with Visual Studio .NET 2005, but I'm using the dependency binary package from OSG homepage which was probably compiled with VS.NET 2003. Maybe this might also cause the crash. I also can't guarantee that other DLLs included in our multithreaded application are release or debug only and compiled with VS.NET 2005. Best regards, Daniel ________________________________ Von: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Im Auftrag von Gordon Tomlinson Gesendet: Mittwoch, 11. Oktober 2006 16:26 An: osg users Betreff: RE: [osg-users] OSG crash when calling getEnv() caused byOpenThreadsbug in Win32 implementation? Were all your libraries compiled using the same compiler ? were you using all debug and release version or mixing when crashing ? Best Regards Gordon __________________________________________________________ Gordon Tomlinson Email : gordon.tomlinson @ overwatch.com YIM/AIM: Gordon3dBrit MSN IM : Gordon3dBrit @ 3dSceneGraph.com __________________________________________________________ Telephone (Cell): (+1) 214-477-8914 Telephone (Work): (+1) 703-437-7651 "Self defence is not a function of learning tricks but is a function of how quickly and intensely one can arouse one's instinct for survival" - Master Tambo Tetsura -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Behalf Of Kallfass, Daniel, SDGE1 Sent: Wednesday, October 11, 2006 10:22 AM To: osg users Subject: AW: [osg-users] OSG crash when calling getEnv() caused by OpenThreadsbug in Win32 implementation? Hello, I have changed the lines 94 and 335-337 (see the attached file), so that the OpenThreads Now uses _beginthreadex instead of CreateThread so ensure that The c-runtime is initialized correctly for a multithreaded environment. I'm not quite sure if this was the reason for the crash while calling getEnv() in osg/osgDB, but I haven't noticed any crashes since this change. Daniel Kallfass ________________________________ Von: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Im Auftrag von Thibault Genessay Gesendet: Dienstag, 10. Oktober 2006 11:55 An: osg users Betreff: Re: [osg-users] OSG crash when calling getEnv() caused by OpenThreadsbug in Win32 implementation? Hi On 10/10/06, Kallfass, Daniel, SDGE1 <[EMAIL PROTECTED]> wrote: Hello, due to crashes that occur in OSG calling the getEnv() c-function in our multithreaded application, I tried to figure out what could be wrong. I noticed that the OpenThreads implementation for Win32 is using the Windows API function "CreateThread". But this function must not be used in conjunction with the c-runtime. The function "_beginthreadex" should be used instead. http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vccore/ html/_core_Library_Support_for_Multithreading.asp http://www.microsoft.com/msj/0799/win32/win320799.aspx After carefully reading both articles, I still have some interrogations: does not the issue of using CreateThread instead of _createthreadex only applies when linking against LIBCMT ? The OSG/OP/OT is using MSVCRT (aka "Multithreaded runtime DLL" in Visual Studio) so the second point of the second paragraph of the second article (following me ?:) could apply ... which could be summarized as "use CreateThread". This is what ( i.e. the current OT) I've been doing for years without a hitch; but as I very rarely call the c-runtime, I might have simply never encountered your situation. But: - "In Redmond, do as Microsoft do" used to say my grandma - http://www.microsoft.com/msj/1099/win32/win321099.aspx insists on _beginthreadex being more robust So I think you are right: we should switch to _beginthreadex and _endthreadex because even if it does not solve your bug, it is a cleaner practice. Snip: "There is absolutely no disadvantage to calling _beginthreadex, and your code is much safer. Besides, there are several advantages: compile-time checking if you link to an improper C runtime library; guaranteed freeing of the _tiddata block regardless of whether you're creating an EXE or a DLL and regardless of which multithreaded C runtime library you're using; signal support; and floating point exception support" Thibault _______________________________________________ osg-users mailing list [email protected] http://openscenegraph.net/mailman/listinfo/osg-users http://www.openscenegraph.org/
-- Serge Lages http://www.magrathea-engine.org _______________________________________________ osg-users mailing list [email protected] http://openscenegraph.net/mailman/listinfo/osg-users http://www.openscenegraph.org/
