Hi Caolán,
On Fri, 27 May 2011 11:02:28 +0100
Caolán McNamara <caolanm@redhat.com> wrote:
Well, if we look at the original code, given that s_pThrower is just a
normal local variable set to 0, then we *always* enter the first if,
and the first if always takes a MutexGuard from the global mutex, so
we always lock inside the first branch, which is the only one
executed.
right.
So the original code doesn't do what it apparently thought it was
doing of using a double-check lock, but ends up using a unconditional
mutex lock every time, so it should be ok on all platforms/compilers,
no ?
If the stuff protected protected by the mutex has no side effects, yes.
If it has, the code would be executed twice -- although neatly
serialized by the mutex. Now gcc with bug 13684 fixed should never init
the static variable twice, so even if the ctor has side effects, it
would not hurt. And the pointer assignment is atomic and has no side
effects.
I think, given the unconditional mutex lock that it should be ok as it
stands for 3-4.
Unless a compiler does not keep static variables threadsafe and the
ctor has side effects (I have not looked at that yet).
Is the crash reproducible for you in any way ? It'd be much more
confident with a reproducible scenario we could run under valgrind.
Unfortunately not. Various descriptions:
- Returning to a document after 10 hours
- Calc crash, high CPU load from other apps
- crashed while opening one writer and one calc document
Most of these just point to high load -- of course exceptions are more
likely then.
As an aside, what gcc is in use ?
gcc (Ubuntu/Linaro 4.5.2-8ubuntu4) 4.5.2
Best,
Bjoern
--
https://launchpad.net/~bjoern-michaelsen
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.