This is a WINDOWS problem only.
It works under Linux, MacOSX just fine.
Sorry for not pointing it out more clearly.
To reply Juan, the problem of using static variables for destruction is that
it causes exactly this problem :-)
If the static variable is defined in the MAIN-APP, it works just fine. In
the same way that atexit() works when it is called from the main-app.
It is when the static variable (in your case static Deallocator deallocator)
is defined in the .dll file for our library the problem occurs.
So I can recreate exactly the same problem by using static deallocators
instead of atexit():
1. If deallocation of the thread occurs in "main", it works
2. If deallocation of the thread occurs in "dll" it hangs.
Same code works in Linux/Mac regardless of gcc version.
We have "deallocators" in the form of Singletons, which are handled by a
SingletonManager, which is responsible of shutting things down in a specific
order.
Problem is just, when should the "destructors" be called?
Explicitly:
main()
{
...
shutdown(); // Works fine, thread dies happy.
}
or implicitly by the scope of static variables? (preferred so that user does
not have to call shutdown();
/A
On Fri, Dec 3, 2010 at 11:20 AM, Robert Osfield <[email protected]>wrote:
> Hi Anders,
>
> I have just had a look at your test example and it fails to compile
> under linux due to the atexit() method.
>
> Reviewing the code I'm a bit confused why you are using atexit()
> method at all. The OSG itself has lots of threads, objects and
> singleton created in difference places at different times and works
> fine with a platform specific exit mechanism, so I would have thought
> it should be possible for your app as well.
>
> Robert.
> _______________________________________________
> osg-users mailing list
> [email protected]
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>
--
__________________________________________
Anders Backman, CTO Algoryx Simulation AB
Uminova Science Park, Box 7973, SE-907 19
UmeƄ, Sweden
[email protected] http://www.algoryx.se
Cell: +46-70-392 64 67
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org