aboutsummaryrefslogtreecommitdiff
path: root/Emby.Server.Implementations/AppBase/BaseConfigurationManager.cs
diff options
context:
space:
mode:
authordkanada <dkanada@users.noreply.github.com>2019-11-02 02:07:20 +0900
committerGitHub <noreply@github.com>2019-11-02 02:07:20 +0900
commit48a99366b6bd0fea13fb40c6c16374052d5adb6d (patch)
treeb8a24e6870e818e61d585f4c71ae6346d8ab2d07 /Emby.Server.Implementations/AppBase/BaseConfigurationManager.cs
parent89a21c96c05dd89ff2d2bd5926d0f98c6ef0db9b (diff)
parent5e0858d13fb9343e53b03c93739b87fdd6087ecf (diff)
Merge pull request #1789 from Bond-009/deps
Update deps and add MultiThreading analyzer
Diffstat (limited to 'Emby.Server.Implementations/AppBase/BaseConfigurationManager.cs')
-rw-r--r--Emby.Server.Implementations/AppBase/BaseConfigurationManager.cs25
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
{