[Libreoffice] Helgrind results for LO

Caolán McNamara caolanm at redhat.com
Thu Mar 31 06:53:13 PDT 2011


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.



More information about the LibreOffice mailing list