Well, I have done some thorough googling on the matter, and it is a general
problem in dll-vs-atexit-static variables problem.

So it is most probably not a bug in OpenThreads. Lets close that issue.
Each dll has its own "order of destruction" for static variables, combine
that with that each dll-has its own order of execution of atexit() it
becomes a problem.

Smack the condition-locks that windows use internally for loading dll, which
by the way are handled as static variables, you have a mess.

Lights down, thanks for the attention :-)

/A

On Fri, Dec 3, 2010 at 12:59 PM, Robert Osfield <[email protected]>wrote:

> 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
>



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

Reply via email to