Hi Robert, I have implemented threadsafe reference counting using atomic operations if available for the target platform.
There is a configure check which searches for different implementations and selects one that is available. Based on that configure check, a file include/OpenThreads/Config is created that stores that configuration decision. There are two new classes in OpenThreads that serve as an abstraction for the atomic operations. If no atomic value implementation is available at the target platform the class falls back to using mutexes. So this class is thread safe in any case. Referenced is modified to use that atomic operations for reference counting and creation of the a mutex locked observer set pointer iff there is an implementation for the atomic data type *without* mutex available. If we have atomic operations with a mutex, the old strategy is used. In effect I get a few percent framerate improovements for my test models with osgviewer compared to the case where we force thread safe reference counting by the environment variable for example. The non thread safe implementations delivers about the same frame rate than the atomic reference count one on x86_64. The memory consumption of Referenced itself is one pointer fewer when using atomic ops. I did not test that on windows so far, but took the implementation from some of my own codes that already works on windows. In particular, I do not know if the cmake tests will work as is on windows. The change is based on revision 8397. Comments? Mathias -- Dr. Mathias Fröhlich, science + computing ag, Software Solutions Hagellocher Weg 71-75, D-72070 Tuebingen, Germany Phone: +49 7071 9457-268, Fax: +49 7071 9457-511 -- Vorstand/Board of Management: Dr. Bernd Finkbeiner, Dr. Florian Geyer, Dr. Roland Niemeier, Dr. Arno Steitz, Dr. Ingrid Zech Vorsitzender des Aufsichtsrats/ Chairman of the Supervisory Board: Prof. Dr. Hanns Ruder Sitz/Registered Office: Tuebingen Registergericht/Registration Court: Stuttgart Registernummer/Commercial Register No.: HRB 382196
referenced-8397.tar.bz2
Description: application/tbz
_______________________________________________ osg-submissions mailing list [email protected] http://lists.openscenegraph.org/listinfo.cgi/osg-submissions-openscenegraph.org
