Hello Aron,

Aron Bierbaum wrote:
> How are you supposed to clean up a lock that is managed by OpenSG. It
> appears that you can remove it from the ThreadManager using
> removeLock(). This method does not delete the Lock though, and if it
> did the deconstructor of the Lock actually calls back into
> ThreadManager::removeLock().

AFAIUI the idea is to delete the lock (i.e. have it go out of scope or 
call delete on it) and it will deregister itself from the ThreadManager.

> I know that people really shouldn't be
> allocating Locks all that much, I just noticed it with the debug
> output I received while using the debug build:
> 
> WARNING: ThreadManager::shutdown: condvar
> [BackgroundLoader-CondVar|0B907870] is still alive
> WARNING: ThreadManager::shutdown: lock [OSG::Log::_pLogLock|0887FFD8]
> is still alive
> WARNING: ThreadManager::shutdown: lock [OSGTMStoreLock|0863C208] is still 
> alive
> WARNING: ThreadManager::shutdown: lock
> [PerfMonitor::mDataLock|0888DFC8] is still alive

However during system shutdown (specifically ThreadManager shutdown) 
this does not happen (see the early out if in 
ThreadManager::removeLock). For PerfMonitor and BackgroundLoader the 
right approach would be to register clean-up functions that delete the 
locks. ... Oh, now I see the problem, just deleting the lock looks quite 
asymmetric to how it is created and there is no good way of knowing how 
many pointers to a Lock exist...
Hm, Lock and co are derived from MemoryObject so they are prepared to be 
ref counted, it just looks as if it is not done ATM.
Anyways, for the singleton cases you still get away with just deleting 
the lock from the registered cleanup function as there are not multiple 
places pointing to the same Lock.

        Cheers, 
                Carsten

------------------------------------------------------------------------------
Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA
-OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise
-Strategies to boost innovation and cut costs with open source participation
-Receive a $600 discount off the registration fee with the source code: SFAD
http://p.sf.net/sfu/XcvMzF8H
_______________________________________________
Opensg-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/opensg-users

Reply via email to