Hi Tanguy,
I was wondering about the possibility of wrapping up the access to the
sensitive C functions using a Mutex. We couldn't do it in local code,
but would need to do it via a single custom getenv() etc. function
implementation, otherwise we'd still end up with multiple functions
potentially accessing standard C functions like getenv in a parallel.
Like Daniel's suggestion of moving the Mutex into the getenv init
avoiding the overuse of the locking the mutex, doing the lock in
central function would also achieve this aim.
So perhaps we co do something like:
static Mutex s_mutex;
const char* serialized_getenv(const char* str)
{
ScopedLock lock(s_mutex);
return getenv(str);
}
void* serialized_otherSensitiveCFunction(...)
{
ScopedLock lock(s_mutex);
return otherSensitiveCFunction(...);
}
Then all the init code would call these methods. Note the
implementations would all be in the .cpp's.
Thoughts?
Robert.
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org