Thanks Laurens, I think the approach you have taken is the most
sensible, fix now merged and submitted to svn/trunk and OSG-3.2
branch.

On 18 June 2014 11:01, l.voerman <[email protected]> wrote:
> Hi Robert,
> In order to speed up loading large scenes (especially from network disk) I
> added code to our viewer to setup multiple database-pagers and request the
> files trough a database-request:
> databasePager->setUpThreads(16, 1);
>
> We experienced problems with multiple databasepagers loading files in
> parallel, when two threads start to load the same file (usually a texture
> referenced by multiple models). The second thread to add the file to the
> cache (sometimes) manages to do so while the refcount from the cached object
> still is zero, causing the object loaded to be destroyed.
> Sometimes the second thread manages to ref() the object before
> Referenced::signalObserversAndDelete does the final recount check, causing a
> warning:
>     "Warning Referenced::signalObserversAndDelete(,,) doing delete with
> _refCount=1"
>
> With a deleted object added to the scenegraph we get some undesired results,
> I think the program only crashes if the object was a Node, and just has some
> untextured surfaces if it was a texture, but I'm not completely sure.
>
> Attached is a modified version of the Registry.cpp, returning the object in
> cache and let the duplicate loaded object to be destroyed.
>
> A more efficient option would be to add some sort of blocking entry to the
> objectcache to stop the second thread from reading the file, and just wait
> until the first thread added it to the cache. If you think that's worthwile
> we would be happy to implement that version. A bit tricky to implement and
> test, that's why I submit a simple version that stops my program from
> crashing.
>
>
> Registry.cpp is based on Stable 3.2 branch  - svn trunk has an new
> fileExtentionAlias added.
>
> Regards Laurens.
>
> _______________________________________________
> osg-submissions mailing list
> [email protected]
> http://lists.openscenegraph.org/listinfo.cgi/osg-submissions-openscenegraph.org
>
_______________________________________________
osg-submissions mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-submissions-openscenegraph.org

Reply via email to