Front page | perl.perl5.porters |
Postings from September 2017
RFC: PERL_REENTR
Thread Next
From:
Karl Williamson
Date:
September 1, 2017 22:02
Subject:
RFC: PERL_REENTR
Message ID:
34bdd4b0-afb6-9580-6c5b-5ccebe7db59e@khwilliamson.com
Perl has a facility for automatically and invisibly substituting
reentrant library functions when the non-reentrant one is called.
For example, asctime() calls are automatically transformed into
asctime_r() calls.
This minimizes the chances of races in multi-threaded perls.
The substitution is not needed nor done unless the perl is built
multi-threaded.
Nor is it needed, the comments say, on Windows, and not done.
Nor is it done on Darwin, but I don't know why.
Nor is it done outside the core and PERL_EXT modules.
We tell module writers they should be using these functions, and that
mixing them with the non-reentrant ones is asking for trouble. Yet we
in the core use the reentrant ones, and so they must to, it appears, and
must do it manually, which leads to portability issues in knowing which
are valid on the currently running platform.
It seems to me we should either extend this to work on all modules or
allow a module to #define PERL_REENTR to enable it. Thus they wouldn't
be lying and saying PERL_EXT when it isn't true.
I don't fully understand some of the code, but it appears that it is too
closely tied to the core for even PERL_EXT to work properly, since it is
switching on PL_op->op_type. But it appears that it could be fixed to
not do that.
I presume there are good reasons we don't just substitute our preferred
functions for what an XS writer has specified.
So I'm suggesting that we allow the writers to #define PERL_REENTR to
gain access to this feature.
Thread Next
-
RFC: PERL_REENTR
by Karl Williamson