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


Hi,

I noticed that Mutex(Guard) C++ helper classes silently ignores
failures to create / acquire / release / destroy a mutex, which seems
rather worrying: if one puts a mutex acquire, it means the rest of the
code should not execute if the mutex was not acquired, lest subtle
bugs crop up (corruption of thread-shared variables and all that).

So my natural tendency would be to make create (in Mutex::Mutex) and
acquire (in Guard::Guard, ResettableGuard::reset, etc) errors "hard"
errors by throwing a RuntimeException; that is, obviously, unless the
file is compiled without exception support, in which case... we
fallback to the current behaviour? Or rather an OSL_FAIL?

Release errors in a MutexGuard destructor cannot be an exception, so
an OSL_FAIL.

The Mutex/MutexGuard classes are implemented 100% in header file, so
they can adapt to the compilation options of the file they are used
in, and it seems the LO build system nicely defines EXCEPTIONS_ON or
EXCEPTIONS_OFF to give that information.


Opinions? Any reason this is a bad idea?


-- 
Lionel

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.