Date: prev next · Thread: first prev next last
2011 Archives by date, by thread · List index


On Thu, 2011-03-31 at 14:00 +0200, Julian Seward wrote:
Surely some part of LO uses threadsafe refcounted classes?

There's the common thread-safe shared ownership rtl_uString string, etc.
e.g. sal/rtl/source/strtmpl.c and the use of thread-safe
osl_incrementInterlockedCount/osl_decrementInterlockedCount refcount
stuff.

A bzip2'd text file containing the actual reports is attached.  It
also contains details of how to reproduce them.

The first one at least seems to be the common enough pattern we have
where we grab our global mutex when initializing singletons on first
use/creation e.g.

const Class& foo()
{
        static Class aFoo;
        if (aFoo.uninit) //need to init this
        {
                //grab mutex
                MutexGuard guard(Mutex::getGlobalMutex());
                //make sure some other thread didn't already do it
                //while waiting to get mutex
                if (aFoo.uninit)
                        aFoo.init;
        }
        return aFoo;
}

so we have loads of warnings along the lines of "the last time you
accessed that singleton you took a mutex, but this time you didn't!"

I guess we might need to sprinkle that
VALGRIND_HELGRIND_DISABLE_CHECKING(&pInstance, sizeof pInstance);
pixie-dust you mentioned at the con here and there. There is a
rtl::Static template for the above pattern into which it might be
possible to work that macro somehow to make this easier, still a to-do
investigate for me.

C.


Context


Privacy Policy | Impressum (Legal Info) | Copyright information: Unless otherwise specified, all text and images on this website are licensed under the Creative Commons Attribution-Share Alike 3.0 License. This does not include the source code of LibreOffice, which is licensed under the Mozilla Public License (MPLv2). "LibreOffice" and "The Document Foundation" are registered trademarks of their corresponding registered owners or are in actual use as trademarks in one or more countries. Their respective logos and icons are also subject to international copyright laws. Use thereof is explained in our trademark policy.