Hi Adrian,

Putting serializers into osgDB is the wrong thing to do, as I did
quite a bit of work a year or so back to avoid the need for this - its
architected to support multi-threaded read calls.

Not all plugins are thread safe though and do require serializers so
its here I'd suggest you look to as the possible cause of threading
problems.  It could be that there are bugs in osgDB which mean that
its not thread safe, so these need to be looked.   The first step is
to track down where the problem is, not to go swipe the problem but
castrating another part of the OSG.

Robert.

On 8/20/07, Adrian Egli <[EMAIL PROTECTED]> wrote:
> Hi robert,
>
> there is an other problem i currently have with the database pager. In fact
> we have to protect our readNodeFile
> otherwise we run into threading issues. The method is not thread safe at
> all, so we have to protect it as you
> did in database pager, in common application it work as expected, we are
> thread safe
>
>
> Line 565: DatabasePager.cpp
>                 bool serialize_readNodeFile = true;
>                 if (serialize_readNodeFile)
>                 {
>                     // do *not* assume that we only have one DatabasePager,
> or that reaNodeFile is thread safe...
>                     static OpenThreads::Mutex
> s_serialize_readNodeFile_mutex;
>
> OpenThreads::ScopedLock<OpenThreads::Mutex>
> lock(s_serialize_readNodeFile_mutex);
>                     databaseRequest->_loadedModel =
> osgDB::readNodeFile(databaseRequest->_fileName,
>
> databaseRequest->_loadOptions.get());
>                 }
>                 else
>                 {
>                     // assume that we only have one DatabasePager, or that
> readNodeFile is thread safe...
>                     databaseRequest->_loadedModel =
> osgDB::readNodeFile(databaseRequest->_fileName,
>
> databaseRequest->_loadOptions.get());
>                 }
>
> can you move the s_serialize_readNodeFile_mutex into the API (database pager
> header) i need to lock / unlock it in an other thread. so it would be quite
> important
> that i can access this mutex outside the databasepager.cpp . please make a
> method to lock, unlock the s_serialize_readNodeFile_mutex then i can myself
> protect the readNodeFile. The best would be to attach the readNodeFile lock
> in the API  readfile as static method, so everybody can make use of this
> protection.
>
> sugestion:
>
> add in ReadFile:
>
>                    static OpenThread::Mutex ;
>
> and in the DatabasePager:
>
> OpenThreads::ScopedLock<OpenThreads::Mutex>
> lock(osgDB::s_serialize_readNodeFile_mutex);
>
>
>
> /Adegli
>
> --
> ********************************************
> Adrian Egli
> _______________________________________________
> osg-users mailing list
> [email protected]
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>
>
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to