diff options
author | Karl Williamson <khw@cpan.org> | 2018-01-17 11:22:02 -0700 |
---|---|---|
committer | Karl Williamson <khw@cpan.org> | 2018-01-31 06:57:50 -0700 |
commit | 6e4200280cd1c3843eea21c73aab78a8c7063027 (patch) | |
tree | bc4ca87f14602c2e538d50aec6644cbd5fb5c1f6 /ext/POSIX | |
parent | 7fcf92725e7e815c0b85c20ffa6fa06bd425098b (diff) | |
download | perl-6e4200280cd1c3843eea21c73aab78a8c7063027.tar.gz |
POSIX.xs: Add mutex around localeconv()
If another thread calls localeconv(), it can destroy the returned
buffer. This adds a mutex around this call; the only other place in the
core that calls it already has this mutex, so they now are thread-safe.
Diffstat (limited to 'ext/POSIX')
-rw-r--r-- | ext/POSIX/POSIX.xs | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/ext/POSIX/POSIX.xs b/ext/POSIX/POSIX.xs index 7d481c41f3..0ab9470832 100644 --- a/ext/POSIX/POSIX.xs +++ b/ext/POSIX/POSIX.xs @@ -2145,6 +2145,8 @@ localeconv() RETVAL = newHV(); sv_2mortal((SV*)RETVAL); + LOCALE_LOCK; /* Prevent interference with other threads using + localeconv() */ lcbuf = localeconv(); if (lcbuf) { @@ -2198,6 +2200,7 @@ localeconv() } } + LOCALE_UNLOCK; RESTORE_LC_NUMERIC(); #endif /* HAS_LOCALECONV */ OUTPUT: |