Hi Anders,

I'm pretty sure is not a threading issue / bug in OpenThreads, I
believe it's an issue of proper management of the destruction order of
objects/implementations.  When you use singletons you have to be
particularly careful if you are relying upon automatic clean up
provided by the static object destruction.

One way you could handle the issue of implementations provided by
dll's being unloaded prior to your singleton destructing is for the
dll to have a static varaible that on the dll's unloaded/destruction
will call the singleton to remove/clean up itself and instances of
threads it provides correctly.   If when the singleton gets destructed
and their are still threads there that need destructing it can do so.

To do it I think you'll probably need not just the Thread subclasses
in the plugin/library but also a statically created CleanUp class that
when it destructs it knows about which types of Threads are associated
with it and need cleaning up.  One way to do this might be have this
helper class create and destroy the Threads that are associate with
that plugin/library, maintaining a local list of these Threads.  The
singleton then wouldn't directly have the list of threds, just a list
of the help class.

Robert.
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to