diff options
| author | Bond-009 <bond.009@outlook.com> | 2019-11-07 10:50:55 +0100 |
|---|---|---|
| committer | Bond-009 <bond.009@outlook.com> | 2019-11-07 10:50:55 +0100 |
| commit | 983d38a43bd617de11724196f35822f07860a2eb (patch) | |
| tree | 0eb15c7d7a5a4c270f966b6c4a8aee60f4a1a60e /Emby.Server.Implementations/AppBase/BaseConfigurationManager.cs | |
| parent | 81c135c5bb01fbfb62ce67dc091e3e9f1c6d2c10 (diff) | |
| parent | 2779d9d3bc9a9fd731e118f57d4601de4a55d032 (diff) | |
Merge branch 'master' into installationmanager
Diffstat (limited to 'Emby.Server.Implementations/AppBase/BaseConfigurationManager.cs')
| -rw-r--r-- | Emby.Server.Implementations/AppBase/BaseConfigurationManager.cs | 25 |
1 files changed, 20 insertions, 5 deletions
diff --git a/Emby.Server.Implementations/AppBase/BaseConfigurationManager.cs b/Emby.Server.Implementations/AppBase/BaseConfigurationManager.cs index 4832c19c4..7ec5252d0 100644 --- a/Emby.Server.Implementations/AppBase/BaseConfigurationManager.cs +++ b/Emby.Server.Implementations/AppBase/BaseConfigurationManager.cs @@ -35,7 +35,7 @@ namespace Emby.Server.Implementations.AppBase /// <summary> /// The _configuration sync lock. /// </summary> - private object _configurationSyncLock = new object(); + private readonly object _configurationSyncLock = new object(); /// <summary> /// The _configuration. @@ -98,16 +98,31 @@ namespace Emby.Server.Implementations.AppBase public IApplicationPaths CommonApplicationPaths { get; private set; } /// <summary> - /// Gets the system configuration + /// Gets the system configuration. /// </summary> /// <value>The configuration.</value> public BaseApplicationConfiguration CommonConfiguration { get { - // Lazy load - LazyInitializer.EnsureInitialized(ref _configuration, ref _configurationLoaded, ref _configurationSyncLock, () => (BaseApplicationConfiguration)ConfigurationHelper.GetXmlConfiguration(ConfigurationType, CommonApplicationPaths.SystemConfigurationFilePath, XmlSerializer)); - return _configuration; + if (_configurationLoaded) + { + return _configuration; + } + + lock (_configurationSyncLock) + { + if (_configurationLoaded) + { + return _configuration; + } + + _configuration = (BaseApplicationConfiguration)ConfigurationHelper.GetXmlConfiguration(ConfigurationType, CommonApplicationPaths.SystemConfigurationFilePath, XmlSerializer); + + _configurationLoaded = true; + + return _configuration; + } } protected set { |
