Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ build/
*.pidb
*.log
*.scc
*/.vs/*

# Visual C++ cache files
ipch/
Expand Down
16 changes: 16 additions & 0 deletions csharp/PhoneNumbers/PhoneNumberUtil.cs
Original file line number Diff line number Diff line change
Expand Up @@ -857,6 +857,14 @@ public IReadOnlyDictionary<int, List<String>> CallingCodeToRegion
public static PhoneNumberUtil GetInstance(String baseFileLocation,
Dictionary<int, List<String>> countryCallingCodeToRegionCodeMap)
{
//double-check on purpose to avoid locking
//Storing value in a temp variable first, because it can get reset to null.
var i = instance_;
if (i != null)
{
return i;
}

lock (thisLock)
{
if (instance_ == null)
Expand Down Expand Up @@ -909,6 +917,14 @@ public Dictionary<int, PhoneMetadata>.KeyCollection GetSupportedGlobalNetworkCal
*/
public static PhoneNumberUtil GetInstance()
{
//double-check on purpose to avoid locking
//Storing value in a temp variable first, because it can get reset to null.
var i = instance_;
if (i != null)
{
return i;
}

lock (thisLock)
{
if (instance_ == null)
Expand Down