summaryrefslogtreecommitdiff
path: root/ext/DynaLoader/dl_next.xs
diff options
context:
space:
mode:
authorJarkko Hietaniemi <jhi@iki.fi>2001-10-24 22:02:23 +0000
committerJarkko Hietaniemi <jhi@iki.fi>2001-10-24 22:02:23 +0000
commitcdc73a103e56840003cb817a381323974e4b9832 (patch)
tree981c44d00a07e8db26f6300ebb3263f48b4785c3 /ext/DynaLoader/dl_next.xs
parent313e3311ff463cfb1de02a3e944a3a32a6497023 (diff)
downloadperl-cdc73a103e56840003cb817a381323974e4b9832.tar.gz
Integrate change #12626 from maintperl;
make DynaLoader threadsafe by moving all statics into interpreter-local space TODO: Netware, OS/2, WinCE p4raw-link: @12626 on //depot/maint-5.6/perl: 512dcce54ea4db665708f91609bdd0a6126d1acd p4raw-id: //depot/perl@12627 p4raw-integrated: from //depot/maint-5.6/perl@12625 'copy in' ext/DynaLoader/dl_beos.xs ext/DynaLoader/dl_dld.xs ext/DynaLoader/dl_dyld.xs ext/DynaLoader/dl_hpux.xs ext/DynaLoader/dl_next.xs ext/DynaLoader/dl_vmesa.xs ext/DynaLoader/dl_vms.xs (@5902..) ext/DynaLoader/dl_dllload.xs (@8789..) 'merge in' ext/DynaLoader/dl_mpeix.xs ext/DynaLoader/dlutils.c win32/dl_win32.xs (@5902..) ext/DynaLoader/dl_dlopen.xs (@8631..) ext/DynaLoader/dl_aix.xs (@9416..) ext/DynaLoader/dl_mac.xs (@12597..)
Diffstat (limited to 'ext/DynaLoader/dl_next.xs')
-rw-r--r--ext/DynaLoader/dl_next.xs22
1 files changed, 17 insertions, 5 deletions
diff --git a/ext/DynaLoader/dl_next.xs b/ext/DynaLoader/dl_next.xs
index b8c19f203e..405082664d 100644
--- a/ext/DynaLoader/dl_next.xs
+++ b/ext/DynaLoader/dl_next.xs
@@ -44,14 +44,19 @@ Anno Siegel
#define DL_LOADONCEONLY
-#include "dlutils.c" /* SaveError() etc */
+typedef struct {
+ AV * x_resolve_using;
+} my_cxtx_t; /* this *must* be named my_cxtx_t */
+#define DL_CXT_EXTRA /* ask for dl_cxtx to be defined in dlutils.c */
+#include "dlutils.c" /* SaveError() etc */
-static char * dl_last_error = (char *) 0;
-static AV *dl_resolve_using = Nullav;
+#define dl_resolve_using (dl_cxtx.x_resolve_using)
static char *dlerror()
{
+ dTHX;
+ dMY_CXT;
return dl_last_error;
}
@@ -73,6 +78,7 @@ static void TranslateError
(const char *path, enum dyldErrorSource type, int number)
{
dTHX;
+ dMY_CXT;
char *error;
unsigned int index;
static char *OFIErrorStrings[] =
@@ -150,6 +156,7 @@ static void TransferError(NXStream *s)
{
char *buffer;
int len, maxlen;
+ dMY_CXT;
if ( dl_last_error ) {
Safefree(dl_last_error);
@@ -174,6 +181,7 @@ static char *dlopen(char *path, int mode /* mode is ignored */)
char *result;
char **p;
STRLEN n_a;
+ dMY_CXT;
/* Do not load what is already loaded into this process */
if (hv_fetch(dl_loaded_files, path, strlen(path), 0))
@@ -226,7 +234,10 @@ static void
dl_private_init(pTHX)
{
(void)dl_generic_private_init(aTHX);
- dl_resolve_using = get_av("DynaLoader::dl_resolve_using", GV_ADDMULTI);
+ {
+ dMY_CXT;
+ dl_resolve_using = get_av("DynaLoader::dl_resolve_using", GV_ADDMULTI);
+ }
}
MODULE = DynaLoader PACKAGE = DynaLoader
@@ -300,7 +311,8 @@ dl_install_xsub(perl_name, symref, filename="$Package")
char *
dl_error()
CODE:
- RETVAL = LastError ;
+ dMY_CXT;
+ RETVAL = dl_last_error ;
OUTPUT:
RETVAL