From: Craig A. Berry Date: Sat, 7 Mar 2009 20:33:04 +0000 (-0600) Subject: Make DynaLoader clone its private data under threads. X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=8c472fc1d477ec4a43d02ce6fc6458f4004c738d;p=p5sagit%2Fp5-mst-13.2.git Make DynaLoader clone its private data under threads. --- diff --git a/ext/DynaLoader/dl_aix.xs b/ext/DynaLoader/dl_aix.xs index c91a2fc..eac313f 100644 --- a/ext/DynaLoader/dl_aix.xs +++ b/ext/DynaLoader/dl_aix.xs @@ -762,4 +762,19 @@ dl_error() OUTPUT: RETVAL +#if defined(USE_ITHREADS) + +void +CLONE(...) + CODE: + MY_CXT_CLONE; + + /* MY_CXT_CLONE just does a memcpy on the whole structure, so to avoid + * using Perl variables that belong to another thread, we create our + * own for this thread. + */ + MY_CXT.x_dl_last_error = newSVpvn("", 0); + +#endif + # end. diff --git a/ext/DynaLoader/dl_beos.xs b/ext/DynaLoader/dl_beos.xs index 3453d68..2b310ac 100644 --- a/ext/DynaLoader/dl_beos.xs +++ b/ext/DynaLoader/dl_beos.xs @@ -116,4 +116,19 @@ dl_error() OUTPUT: RETVAL +#if defined(USE_ITHREADS) + +void +CLONE(...) + CODE: + MY_CXT_CLONE; + + /* MY_CXT_CLONE just does a memcpy on the whole structure, so to avoid + * using Perl variables that belong to another thread, we create our + * own for this thread. + */ + MY_CXT.x_dl_last_error = newSVpvn("", 0); + +#endif + # end. diff --git a/ext/DynaLoader/dl_dld.xs b/ext/DynaLoader/dl_dld.xs index ab72ca3..b60d25b 100644 --- a/ext/DynaLoader/dl_dld.xs +++ b/ext/DynaLoader/dl_dld.xs @@ -187,4 +187,21 @@ dl_error() OUTPUT: RETVAL +#if defined(USE_ITHREADS) + +void +CLONE(...) + CODE: + MY_CXT_CLONE; + + /* MY_CXT_CLONE just does a memcpy on the whole structure, so to avoid + * using Perl variables that belong to another thread, we create our + * own for this thread. + */ + MY_CXT.x_dl_last_error = newSVpvn("", 0); + dl_resolve_using = get_av("DynaLoader::dl_resolve_using", GV_ADDMULTI); + dl_require_symbols = get_av("DynaLoader::dl_require_symbols", GV_ADDMULTI); + +#endif + # end. diff --git a/ext/DynaLoader/dl_dllload.xs b/ext/DynaLoader/dl_dllload.xs index 61611d7..9d5b2c2 100644 --- a/ext/DynaLoader/dl_dllload.xs +++ b/ext/DynaLoader/dl_dllload.xs @@ -188,4 +188,19 @@ dl_error() OUTPUT: RETVAL +#if defined(USE_ITHREADS) + +void +CLONE(...) + CODE: + MY_CXT_CLONE; + + /* MY_CXT_CLONE just does a memcpy on the whole structure, so to avoid + * using Perl variables that belong to another thread, we create our + * own for this thread. + */ + MY_CXT.x_dl_last_error = newSVpvn("", 0); + +#endif + # end. diff --git a/ext/DynaLoader/dl_dlopen.xs b/ext/DynaLoader/dl_dlopen.xs index 3332758..dfa9d06 100644 --- a/ext/DynaLoader/dl_dlopen.xs +++ b/ext/DynaLoader/dl_dlopen.xs @@ -264,4 +264,19 @@ dl_error() OUTPUT: RETVAL +#if defined(USE_ITHREADS) + +void +CLONE(...) + CODE: + MY_CXT_CLONE; + + /* MY_CXT_CLONE just does a memcpy on the whole structure, so to avoid + * using Perl variables that belong to another thread, we create our + * own for this thread. + */ + MY_CXT.x_dl_last_error = newSVpvn("", 0); + +#endif + # end. diff --git a/ext/DynaLoader/dl_dyld.xs b/ext/DynaLoader/dl_dyld.xs index 8bdadd7..b7ae161 100644 --- a/ext/DynaLoader/dl_dyld.xs +++ b/ext/DynaLoader/dl_dyld.xs @@ -221,4 +221,19 @@ dl_error() OUTPUT: RETVAL +#if defined(USE_ITHREADS) + +void +CLONE(...) + CODE: + MY_CXT_CLONE; + + /* MY_CXT_CLONE just does a memcpy on the whole structure, so to avoid + * using Perl variables that belong to another thread, we create our + * own for this thread. + */ + MY_CXT.x_dl_last_error = newSVpvn("", 0); + +#endif + # end. diff --git a/ext/DynaLoader/dl_hpux.xs b/ext/DynaLoader/dl_hpux.xs index f85dea1..583cfc2 100644 --- a/ext/DynaLoader/dl_hpux.xs +++ b/ext/DynaLoader/dl_hpux.xs @@ -177,4 +177,20 @@ dl_error() OUTPUT: RETVAL +#if defined(USE_ITHREADS) + +void +CLONE(...) + CODE: + MY_CXT_CLONE; + + /* MY_CXT_CLONE just does a memcpy on the whole structure, so to avoid + * using Perl variables that belong to another thread, we create our + * own for this thread. + */ + MY_CXT.x_dl_last_error = newSVpvn("", 0); + dl_resolve_using = get_av("DynaLoader::dl_resolve_using", GV_ADDMULTI); + +#endif + # end. diff --git a/ext/DynaLoader/dl_mac.xs b/ext/DynaLoader/dl_mac.xs index 474cd99..d06bb3b 100644 --- a/ext/DynaLoader/dl_mac.xs +++ b/ext/DynaLoader/dl_mac.xs @@ -144,4 +144,19 @@ dl_error() OUTPUT: RETVAL +#if defined(USE_ITHREADS) + +void +CLONE(...) + CODE: + MY_CXT_CLONE; + + /* MY_CXT_CLONE just does a memcpy on the whole structure, so to avoid + * using Perl variables that belong to another thread, we create our + * own for this thread. + */ + MY_CXT.x_dl_last_error = newSVpvn("", 0); + +#endif + # end. diff --git a/ext/DynaLoader/dl_mpeix.xs b/ext/DynaLoader/dl_mpeix.xs index a73e22a..0c810ad 100644 --- a/ext/DynaLoader/dl_mpeix.xs +++ b/ext/DynaLoader/dl_mpeix.xs @@ -128,4 +128,19 @@ dl_error() OUTPUT: RETVAL +#if defined(USE_ITHREADS) + +void +CLONE(...) + CODE: + MY_CXT_CLONE; + + /* MY_CXT_CLONE just does a memcpy on the whole structure, so to avoid + * using Perl variables that belong to another thread, we create our + * own for this thread. + */ + MY_CXT.x_dl_last_error = newSVpvn("", 0); + +#endif + # end. diff --git a/ext/DynaLoader/dl_next.xs b/ext/DynaLoader/dl_next.xs index 40842fd..e5774c0 100644 --- a/ext/DynaLoader/dl_next.xs +++ b/ext/DynaLoader/dl_next.xs @@ -321,4 +321,20 @@ dl_error() OUTPUT: RETVAL +#if defined(USE_ITHREADS) + +void +CLONE(...) + CODE: + MY_CXT_CLONE; + + /* MY_CXT_CLONE just does a memcpy on the whole structure, so to avoid + * using Perl variables that belong to another thread, we create our + * own for this thread. + */ + MY_CXT.x_dl_last_error = newSVpvn("", 0); + dl_resolve_using = get_av("DynaLoader::dl_resolve_using", GV_ADDMULTI); + +#endif + # end. diff --git a/ext/DynaLoader/dl_symbian.xs b/ext/DynaLoader/dl_symbian.xs index 1461142..d10720b 100644 --- a/ext/DynaLoader/dl_symbian.xs +++ b/ext/DynaLoader/dl_symbian.xs @@ -221,4 +221,19 @@ dl_error() OUTPUT: RETVAL +#if defined(USE_ITHREADS) + +void +CLONE(...) + CODE: + MY_CXT_CLONE; + + /* MY_CXT_CLONE just does a memcpy on the whole structure, so to avoid + * using Perl variables that belong to another thread, we create our + * own for this thread. + */ + MY_CXT.x_dl_last_error = newSVpvn("", 0); + +#endif + # end. diff --git a/ext/DynaLoader/dl_vmesa.xs b/ext/DynaLoader/dl_vmesa.xs index 606c89e..02bb0b2 100644 --- a/ext/DynaLoader/dl_vmesa.xs +++ b/ext/DynaLoader/dl_vmesa.xs @@ -174,4 +174,19 @@ dl_error() OUTPUT: RETVAL +#if defined(USE_ITHREADS) + +void +CLONE(...) + CODE: + MY_CXT_CLONE; + + /* MY_CXT_CLONE just does a memcpy on the whole structure, so to avoid + * using Perl variables that belong to another thread, we create our + * own for this thread. + */ + MY_CXT.x_dl_last_error = newSVpvn("", 0); + +#endif + # end. diff --git a/ext/DynaLoader/dl_vms.xs b/ext/DynaLoader/dl_vms.xs index 5eb0d07..7029c97 100644 --- a/ext/DynaLoader/dl_vms.xs +++ b/ext/DynaLoader/dl_vms.xs @@ -143,7 +143,7 @@ dl_private_init(pTHX) dl_generic_private_init(aTHX); { dMY_CXT; - dl_require_symbols = get_av("DynaLoader::dl_require_symbols", 0x4); + dl_require_symbols = get_av("DynaLoader::dl_require_symbols", GV_ADDMULTI); /* Set up the static control blocks for dl_expand_filespec() */ dl_fab = cc$rms_fab; dl_nam = cc$rms_nam; @@ -358,4 +358,20 @@ dl_error() OUTPUT: RETVAL +#if defined(USE_ITHREADS) + +void +CLONE(...) + CODE: + MY_CXT_CLONE; + + /* MY_CXT_CLONE just does a memcpy on the whole structure, so to avoid + * using Perl variables that belong to another thread, we create our + * own for this thread. + */ + MY_CXT.x_dl_last_error = newSVpvn("", 0); + dl_require_symbols = get_av("DynaLoader::dl_require_symbols", GV_ADDMULTI); + +#endif + # end. diff --git a/win32/dl_win32.xs b/win32/dl_win32.xs index 6c094d2..60ec703 100644 --- a/win32/dl_win32.xs +++ b/win32/dl_win32.xs @@ -187,4 +187,19 @@ dl_error() OUTPUT: RETVAL +#if defined(USE_ITHREADS) + +void +CLONE(...) + CODE: + MY_CXT_CLONE; + + /* MY_CXT_CLONE just does a memcpy on the whole structure, so to avoid + * using Perl variables that belong to another thread, we create our + * own for this thread. + */ + MY_CXT.x_dl_last_error = newSVpvn("", 0); + +#endif + # end.