Hi Tanguy, I don't have a windows box to test against so can't do anything first hand. It does very much sound like Windows threading issue that will require a specific Windows mechanism in your application set up to avoid hitting these problems. I don't what what the solution might be, but perhaps it would require serialization of all system calls like getenv.
The solution will not be ditching singletons. They are extremely useful to design and implementation of the OSG. You simply can't replace them without major surgery of API and implementation, and even if you did you'd loose significant flexibility and function - something which is currently loosely coupled (yes a great OO asset) would end up be far more tightly coupled than it is now. Please remember that the OSG is used heavily by thousands of developers on thousands of applications across dozens of platforms, with many applications which are heavily threaded - and it's been under decades development without this issue cause problems. The problems you are seeing are serious, but they aren't the norm, it's because of your particular application usage model and platform. I'm certainly open to finding an OSG solution, but it'll have to be unobtrusive and require minimal code and API changes, otherwise it simply won't be merged as the cost and risks to existing users will be too great. As a general note, please abstain from using immotive language to try and make your point. I have found over the years that the quality of reasoning if often inversely proportional to how immotive the language is used by a poster, so once I see such language I know it's a early warning of what may well be an unreasonable request. If you have a good point, you don't need trumped up rhetoric, the facts speak for themselves. Robert. On Mon, Aug 3, 2009 at 7:34 PM, Tanguy Fautre<[email protected]> wrote: > Hi all, > > With the help of Aymeric, we've been able to create a small program > reproducing the problem. On my machine (Core i7, Vista x64, VC8 and VC9, > Debug and Release) it deadlocks 99% of the time. Other machines have > shown to deadlock less often (Aymeric's machine deadlocks roughly 20% of > time, Dave's only about 10 %). > > The example program is very simple. While you'll find the full program > with its cmake files attached, I've copy/pasted the heart of the program > directly into this post. The full explanation of why it is deadlocking > has already been posted by Aymeric > (http://forum.openscenegraph.org/viewtopic.php?p=15636). > > Cheers, > > Tanguy > > > > // Library.cpp (to be compiled in Library.dll) > > static const char * env = > std::getenv("LIBRARY_UBER_OPTION_ENV_VARIABLE"); > > > > // Main.cpp (to be compiled in Main.exe) > > void libraryThreadMain(void *) > { > LoadLibraryA("Library.dll"); > } > > void threadMain(void * argv) > { > const char * prog_name = ((char **)argv)[0]; > > struct stat sd; > stat(prog_name, &sd); > } > > int main(int argc, char * argv) > { > HANDLE thread_a = (HANDLE) _beginthread(&libraryThreadMain, 0, > 0); > HANDLE thread_b = (HANDLE) _beginthread(&threadMain, 0, argv); > > WaitForSingleObject(thread_a, INFINITE); > WaitForSingleObject(thread_b, INFINITE); > > CloseHandle(thread_a); > CloseHandle(thread_b); > } > > _______________________________________________ > osg-users mailing list > [email protected] > http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org > > _______________________________________________ osg-users mailing list [email protected] http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

