Skip to content
Merged
Changes from 1 commit
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
Prev Previous commit
Next Next commit
Feedback
  • Loading branch information
Steve Pfister committed Sep 7, 2022
commit 10887243ec99e45820338aca2edf6b3c81ff80b5
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,7 @@ public static DateTimeOffset Now
{
s_loadAndroidTZData = null; // Ensure thread is cleared when cache is loaded
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why store the thread at all? You can use s_startNewBackgroundThread or equivalent for all coordination between threads.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It was in response to review on the original PR, here.

});
s_loadAndroidTZData.IsBackground = true;
}) { IsBackground = true };
}
}

Expand All @@ -65,8 +64,17 @@ public static DateTimeOffset Now
// setting the boolean flag to false immediately after should
// prevent two calls to DateTimeOffset.Now in quick succession
// from both reaching here.
s_loadAndroidTZData.Start();
s_startNewBackgroundThread = false;
//
// In the event multiple threads hit Start at the same time,
// swallow the exception and move on.
try
{
s_loadAndroidTZData.Start();
s_startNewBackgroundThread = false;
}
catch
{
}
}
}

Expand Down