which utilises a global recursive mutex that is dedicated to manage Observer and ObserverSet.
The new global mutex for observers avoids problems with deadlocks that were occurring previously when
an osg::Refenced object was being deleted at the same time as on osg::ObserverNodePath.
the extra capability of making it possible for Observers to assume ownership of a object that would otherwsie be deleted.
Added a thread safe ref_ptr<T> observer_ptr<T>::lock() method for robust access to an observed object. This
makes observer_ptr<> more equivilant to boosts weak_ptr.
The fix was to convert the osg::State to use C pointers for the set of applied PerContexProgram objects, and use the osg::Oberver mechanism to avoid dangling pointers for being maintained in osg::State.
implementation of the atomic increment and decrement into a implementation
file.
This way inlining and compiler optimization can no longer happen for these
implementations, but it fixes compilation on win32 msvc targets. I expect
that this is still faster than with with mutexes.
Also the i386 gcc target gets atomic operations with this patch. By using an
implementation file we can guarantee that we have the right compiler flags
available."
retain objects for several frames before deleting them. Also added RenderStageCache
into CullVistor.cpp that is used for handling RTT osg::Camera's that are being
used in double buffered SceneView usage.
Mutex allocated dynamically when required. Added the following methods to
help manage the usage of the mutex:
void setThreadSafeRefUnref(bool threadSafe);
bool getThreadSafeRefUnref() const;
ref/unref:
/** Set whether reference counting should be use a mutex to create thread reference counting.*/
static void setThreadSafeReferenceCounting(bool enableThreadSafeReferenceCounting);
/** Get whether reference counting is active.*/
static bool getThreadSafeReferenceCounting();
associated variables which were only compiled in on debug build. These optional
methods/static vars were causingproblems when mixing debug and release builds.
not delete the object even if its count goes to 0 or below. This should
only be called in special circumstances, the ReaderWriter::ReadResult
being one of them. This new method has allowed the problem of objects
being multiple referenced on return from readNodeFile() & readImageFile().
objects that are deleted whilest still having a positive _refCount, such
as when a object has been deleted on the stack, yet other references still
exist for it. Have put the desctructor implementation in Object.cpp to
avoid adding yet another file with only a couple of lines of code in.