diff options
author | Nicholas Clark <nick@ccl4.org> | 2021-06-20 17:24:15 +0000 |
---|---|---|
committer | Tony Cook <tony@develop-help.com> | 2021-09-07 15:46:16 +1000 |
commit | 3683a9ee5ad61f8cb5eac30e61b4936bd0445bdb (patch) | |
tree | 8ed6466fad66406cddf2e95282cbd438a9846271 /globals.c | |
parent | 65f7068160bfc9a3f4b195a579c881188cc4fff3 (diff) | |
download | perl-3683a9ee5ad61f8cb5eac30e61b4936bd0445bdb.tar.gz |
If we have thread local storage, use it instead of posix_getspecific().
Declare and use a variable PL_current_context to store a pointer to the
thread's interpreter struct. Use this to implement implicit context undef
ITHREADS, instead of a call to posix_getspecific().
For normal threaded code, this will eliminate function calls. For threaded
code in shared objects (the typical configuration for Linux distribution
builds) there still needs to be a function call to get the pointer to
thread local variables, but there will only be one per function, not one
per read of the variable.
Diffstat (limited to 'globals.c')
-rw-r--r-- | globals.c | 8 |
1 files changed, 8 insertions, 0 deletions
@@ -30,6 +30,14 @@ */ #include "regcomp.h" +/* We need somewhere to declare this. This file seems a good place. + * This is not a regular "global" in that we don't know whether it needs to + * exist until we include threads.h, and we don't want it as part of any + * global struct (if that or something similar is re-introduced. */ + +#if defined(USE_ITHREADS) && defined(PERL_THREAD_LOCAL) +PERL_THREAD_LOCAL void *PL_current_context; +#endif /* * ex: set ts=8 sts=4 sw=4 et: |