SolarMutex: please educate me

Caolán McNamara caolanm at redhat.com
Wed May 15 03:09:22 PDT 2013


On Tue, 2013-05-14 at 11:49 +0200, Stephan Bergmann wrote:
> On 05/13/2013 07:12 PM, Lionel Elie Mamane wrote:
> > Base or Base-related code seems to have some issues around the
> > "SolarMutex".
> >
> > https://bugs.freedesktop.org/show_bug.cgi?id=61725
> > https://bugs.freedesktop.org/show_bug.cgi?id=64241
> > (and others historically)
> >
> > Please educate me on the SolarMutex. What is its meaning, when should
> > be held/acquired, ... From
> > http://cgit.freedesktop.org/libreoffice/core/commit/?id=b34b8d3372364b3c5043da0357ec69505e8d8602,
> > my "guess" is that it is related to GUI stuff. Maybe it should be held
> > when calling a GUI (that is, GTK/Win32/QT/...) function? But it can't
> > be that simple, else vcl would "just do it"... It seems to expect
> > higher-level code to hold it already. Why?
> 
> Historically, the SolarMutex was assumed to be a clever solution to the 
> problem of turning StarOffice from a single-threaded application to a 
> multi-threaded one---lock the SolarMutex around any code that is not yet 
> thread-safe, and be done with it.  Or so people thought.
> 
> The world has long since found out that "single global mutex" is a 
> horrible idea for GUI applications (where all GUI frameworks have 
> settled on "confine relevant code to run in a single event-loop thread" 
> instead).
> 
> This leaves us with completely unmaintainable ("where do I need to lock 
> SolarMutex?"---"nobody knows for sure") and broken (cf. 
> SolarMutexReleaser) code.
> 
> Incidentally, I had exactly the same problem with 
> <https://gerrit.libreoffice.org/#/c/3894/> "TODO: Ensure SolarMutex is 
> locked at DBG_TESTSOLARMUTEX checkpoints" last night.

Yeah, and I'm continually dithering as to where to put one for the
various writer mail merge wizard "oh my god its not locked" asserts.

C.



More information about the LibreOffice mailing list