diff options
author | Karl Williamson <khw@cpan.org> | 2020-12-13 13:06:42 -0700 |
---|---|---|
committer | Karl Williamson <khw@cpan.org> | 2022-06-11 15:21:39 -0600 |
commit | c3c9077b28cc7017aecd9764ab49af9662ce9b0b (patch) | |
tree | ace4a261fffacbfccb390bd86fcede8d02b59ee7 /README.plan9 | |
parent | 12865d70b33295cc1e31678404f5aef517d3a97b (diff) | |
download | perl-c3c9077b28cc7017aecd9764ab49af9662ce9b0b.tar.gz |
Make fc(), qr//i thread-safe on participating platforms
A long standing bug in Perl that has gone undetected is that the array
is global that is created when changing locales and tells fc() and qr//i
matching what the folds are in the new locale.
What this means is that any program only has one set of fold definitions
that apply to all threads within it, even if we claim that the locales
are thread-safe on the given platform. One possibility for this going
undetected so long is that no one is using locales on multi-threaded
systems much. Another possibility is that modern UTF-8 locales have the
same set of folds as any other one.
It is a simple matter to make the fold array per-thread instead of
per-process, and that solves the problem transparently to other code.
I discovered this stress-testing locale handling under threads. That
test will be added in a future commit.
In order to keep from having a dTHX inside foldEQ_locale, it has to have
a pTHX_ parameter. This means that the other functions that function
pointer variables get assigned to point to have to have an identical
signature, which means adding pTHX_ to functions that don't require it.
The bodies of all these are known to the compiler, since they are all
in inline.h or in the same .c file as where they are called. Hence the
compiler can optimize out the unused parameter.
Two calls of STR_WITH_LEN also have to be changed because of C
preprocessor limitations; perhaps there is another way to do it that I'm
unfamiliar with.
Diffstat (limited to 'README.plan9')
0 files changed, 0 insertions, 0 deletions