Hi,

We're trying to use OpenSG from Java in Windows, succeeding somewhat (OpenSGCanvas anyone? ;), but have found that it's quite picky about it's threads.

Mainly, it seems to be assumed that all threads are created by opensg's thread manager, and there seem to be no detection if opensg is executing in a thread which does not have any local storage yet (i.e. change list), and hence there are crashes (mainly in WinThreadBase::getCurrentChangeList(), when dereferencing the changelist pointer-pointer).

This would not be a big problem, since I've managed to derive from ExternalThread and call intialize() to set an aspect to use for threads created in java, so initialization and rendering works just fine.

However, during exit, when the process dies, the C-runtime system deletes all global/class-static data in the OpenSG-dll, and this seem to be done in a thread which has not been initialized (and does not go through any of my code).

I suppose the solution would be to correctly handle the DLL_THREAD_ATTACH and DLL_THREAD_DETACH in the DllMain() function of each DLL. This would allow OpenSG to initialize its thread-local data for all threads being called (either defaulting to one aspect, or using some dummy null-aspect, or something). Also, thread detaching would correctly. However, I have only some experience with DLL's and threading in windows (or at all), so there may be a better way to solve this.

Is this something someone has thought about, had experience with or solved already, I'd be very grateful to hear what you have to say.

Best regards
/Marcus


-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
_______________________________________________
Opensg-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/opensg-users

Reply via email to