Hi Robert,

We've got a custom build of OSG where we've commented out all the unsafe
getenv (we do not use env variables in our application anyway).

I'm gonna give your patch a few runs. In theory, it should not deadlock
(considering all the other unsafe getenv are already commented out).


Cheers,

Tanguy


-----Original Message-----
From: osg-users-boun...@lists.openscenegraph.org
[mailto:osg-users-boun...@lists.openscenegraph.org] On Behalf Of Robert
Osfield
Sent: 06 August 2009 13:28
To: OpenSceneGraph Users
Subject: Re: [osg-users] Deadlock when loading osg.dll, singletons are
evil

Hi Tanguy,

As a first step I've just moved the GLExtension.cpp code that does the
static getenv() into the  osg::getGLExtensionDisableString() method so
it now reads:

std::string& osg::getGLExtensionDisableString()
{
    static const char* envVar = getenv("OSG_GL_EXTENSION_DISABLE");
    static std::string
s_GLExtensionDisableString(envVar?envVar:"Nothing defined");

    return s_GLExtensionDisableString;
}

This isn't yet thread safe, but since the problem in hand isn't directly
a threading one this should be at least a little step towards helping
solve the problem.  Modified file attached.

Could you try this modification out at your end to see if it is
appropriate step forward.  A quick search shows other places where there
is static getenv in the global scope so I don't expect this one tweak to
be a complete solution, but if it does look like a way forward then we
can start rolling the fix out more generally.

Cheers,
Robert.
_______________________________________________
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to