Kaydet (Commit) dcdaca59 authored tarafından Noel Grandin's avatar Noel Grandin Kaydeden (comit) Eike Rathke

use a mutex per instance for SvNumberFormatter

instead of one mutex for all instances. We still keep the global mutex
for some operations because there are some shared global data
structures.

Change-Id: Ic1106baa23d4ade18dbd732ad74979f3996f326b
Reviewed-on: https://gerrit.libreoffice.org/46304Tested-by: 's avatarJenkins <ci@libreoffice.org>
Reviewed-by: 's avatarEike Rathke <erack@redhat.com>
üst 38a3886f
......@@ -320,6 +320,7 @@ class NfCurrencyTable;
class SVL_DLLPUBLIC SvNumberFormatter
{
friend class SvNumberFormatterRegistry_Impl;
public:
/**
* We can't technically have an "infinite" value, so we use an arbitrary
......@@ -803,6 +804,7 @@ public:
static bool IsLocaleInstalled( LanguageType eLang );
private:
mutable ::osl::Mutex m_aMutex;
css::uno::Reference< css::uno::XComponentContext > m_xContext;
LanguageTag maLanguageTag;
std::map<sal_uInt32, std::unique_ptr<SvNumberformat>> aFTable; // Table of format keys to format entries
......@@ -831,7 +833,7 @@ private:
OUString aThousandSep;
OUString aDateSep;
SVL_DLLPRIVATE static bool bCurrencyTableInitialized;
SVL_DLLPRIVATE static volatile bool bCurrencyTableInitialized;
SVL_DLLPRIVATE static sal_uInt16 nSystemCurrencyPosition;
SVL_DLLPRIVATE static SvNumberFormatterRegistry_Impl* pFormatterRegistry;
......@@ -914,10 +916,11 @@ private:
// Substitute a format during GetFormatEntry(), i.e. system formats.
SvNumberformat* ImpSubstituteEntry( SvNumberformat* pFormat, sal_uInt32 * o_pRealKey = nullptr );
public:
// own mutex, may also be used by internal class SvNumberFormatterRegistry_Impl
static ::osl::Mutex& GetGlobalMutex();
::osl::Mutex& GetInstanceMutex() const { return m_aMutex; }
// own static mutex, may also be used by internal class SvNumberFormatterRegistry_Impl
static ::osl::Mutex& GetMutex();
public:
// called by SvNumberFormatterRegistry_Impl::Notify if the default system currency changes
void ResetDefaultSystemCurrency();
......
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment