diff options
author | Jarkko Hietaniemi <jhi@iki.fi> | 2001-10-24 22:02:23 +0000 |
---|---|---|
committer | Jarkko Hietaniemi <jhi@iki.fi> | 2001-10-24 22:02:23 +0000 |
commit | cdc73a103e56840003cb817a381323974e4b9832 (patch) | |
tree | 981c44d00a07e8db26f6300ebb3263f48b4785c3 /ext/DynaLoader/dl_mac.xs | |
parent | 313e3311ff463cfb1de02a3e944a3a32a6497023 (diff) | |
download | perl-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_mac.xs')
-rw-r--r-- | ext/DynaLoader/dl_mac.xs | 31 |
1 files changed, 19 insertions, 12 deletions
diff --git a/ext/DynaLoader/dl_mac.xs b/ext/DynaLoader/dl_mac.xs index 5f48139c56..37422877aa 100644 --- a/ext/DynaLoader/dl_mac.xs +++ b/ext/DynaLoader/dl_mac.xs @@ -23,21 +23,26 @@ #include <CodeFragments.h> +typedef CFragConnectionID ConnectionID; -#include "dlutils.c" /* SaveError() etc */ +typedef struct { + ConnectionID ** x_connections; +} my_cxtx_t; /* this *must* be named my_cxtx_t */ -typedef CFragConnectionID ConnectionID; +#define DL_CXT_EXTRA /* ask for dl_cxtx to be defined in dlutils.c */ +#include "dlutils.c" /* SaveError() etc */ -static ConnectionID ** connections; +#define dl_connections (dl_cxtx.x_connections) static void terminate(void) { - int size = GetHandleSize((Handle) connections) / sizeof(ConnectionID); - HLock((Handle) connections); + dMY_CXT; + int size = GetHandleSize((Handle) dl_connections) / sizeof(ConnectionID); + HLock((Handle) dl_connections); while (size) - CloseConnection(*connections + --size); - DisposeHandle((Handle) connections); - connections = nil; + CloseConnection(*dl_connections + --size); + DisposeHandle((Handle) dl_connections); + dl_connections = nil; } static void @@ -70,11 +75,12 @@ dl_load_file(filename, flags=0) GetDiskFragment( &spec, 0, 0, spec.name, kLoadCFrag, &connID, &mainAddr, errName); if (!err) { - if (!connections) { - connections = (ConnectionID **)NewHandle(0); + dMY_CXT; + if (!dl_connections) { + dl_connections = (ConnectionID **)NewHandle(0); atexit(terminate); } - PtrAndHand((Ptr) &connID, (Handle) connections, sizeof(ConnectionID)); + PtrAndHand((Ptr) &connID, (Handle) dl_connections, sizeof(ConnectionID)); RETVAL = connID; } else RETVAL = (ConnectionID) 0; @@ -130,7 +136,8 @@ dl_install_xsub(perl_name, symref, filename="$Package") char * dl_error() CODE: - RETVAL = LastError ; + dMY_CXT; + RETVAL = dl_last_error ; OUTPUT: RETVAL |