Skip to content

Commit

Permalink
fix: Use atomics for locale initialization (#494)
Browse files Browse the repository at this point in the history
  • Loading branch information
Swatinem authored Mar 5, 2021
1 parent 3b0cba8 commit 5e314ca
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions src/sentry_utils.c
Original file line number Diff line number Diff line change
Expand Up @@ -438,10 +438,9 @@ sentry__iso8601_to_msec(const char *iso)
static sentry__locale_t
c_locale()
{
static bool c_locale_initialized = false;
static long c_locale_initialized = 0;
static sentry__locale_t c_locale;
if (!c_locale_initialized) {
c_locale_initialized = true;
if (sentry__atomic_store(&c_locale_initialized, 1) == 0) {
# ifdef SENTRY_PLATFORM_WINDOWS
c_locale = _create_locale(LC_ALL, "C");
# else
Expand Down

0 comments on commit 5e314ca

Please sign in to comment.