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


On Tue, 2013-04-30 at 12:17 +0200, Thorsten Behrens wrote:
diff --git a/drawinglayer/source/primitive3d/polygontubeprimitive3d.cxx 
b/drawinglayer/source/primitive3d/polygontubeprimitive3d.cxx
index 77487db..495c06f 100644
--- a/drawinglayer/source/primitive3d/polygontubeprimitive3d.cxx
+++ b/drawinglayer/source/primitive3d/polygontubeprimitive3d.cxx
@@ -42,9 +42,10 @@ namespace drawinglayer
                 static Primitive3DSequence aLineTubeList;
                 static sal_uInt32 nLineTubeSegments(0L);
                 static attribute::MaterialAttribute3D aLineMaterial;
+                static ::osl::Mutex aMutex;
 
                 // may exclusively change static data, use mutex
-                ::osl::Mutex m_mutex;
+                ::osl::MutexGuard aGuard(aMutex);
 
Thanks a lot for that cleanup!

There are two more instances of that kind in this file though, and
beyond that - anyone eager to replace this with proper rtl::Static
(with the benefit of much faster subsequent access to the statics)?

Usage is rather nicely documented in include/rtl/instance.hxx - for
this case, StaticWithInit seems ideal.

Seeing as the statics in there aren't read-only init-once type of
things, but rather modifyable things the lock taken when they get
potentially modified needs to remain.

I wrapped up those related statics into classes and made safe singletons
of those, and locked their get_modified_cache_thingies as
http://cgit.freedesktop.org/libreoffice/core/commit/?id=92e5232dcbda1696a0e7c05defb3b6a00f4abdd7

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.