1
0
Fork 0
mirror of https://github.com/beefytech/Beef.git synced 2025-06-10 12:32:20 +02:00

Merge pull request #1077 from disarray2077/tzi_threadsafety

Fix a thread safety issue in TimeZoneInfo
This commit is contained in:
Brian Fiete 2021-06-22 07:25:50 -07:00 committed by GitHub
commit 97e399f57d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -253,7 +253,10 @@ namespace System {
if (rule != null)
rule = rule.Clone();
oneYearLocFromUtc = new OffsetAndRule(year, currentYear.BaseUtcOffset, rule);
m_oneYearLocalFromUtc = oneYearLocFromUtc;
if (Interlocked.CompareExchange(ref m_oneYearLocalFromUtc, null, oneYearLocFromUtc) != null) {
delete oneYearLocFromUtc;
oneYearLocFromUtc = m_oneYearLocalFromUtc;
}
}
return oneYearLocFromUtc;
}