This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Initialize RMS structs at clone time in dl_vms.xs.
authorCraig A. Berry <craigberry@mac.com>
Sun, 1 Feb 2015 00:15:48 +0000 (18:15 -0600)
committerCraig A. Berry <craigberry@mac.com>
Sun, 1 Feb 2015 03:05:23 +0000 (21:05 -0600)
When we clone the interpreter-specific data, we create new copies
of these structures under my_cxtp.  However, the copy contains
pointers that reference portions of the old structure, not the
copy.  Surprisingly, this usually works, but it does mean using
another thread's data and has recently turned into a test failure
via an access violation in dist/Thread-Queue/t/02_refs.t.

So let's copy a few lines from dl_private_init to the point at
which we clone, thus making sure those structures are initialized
once per thread.

It seems I really should have done this way back in 8c472fc1d477e.

ext/DynaLoader/DynaLoader_pm.PL
ext/DynaLoader/dl_vms.xs

index c9800b7..c59dd5a 100644 (file)
@@ -85,7 +85,7 @@ package DynaLoader;
 # Tim.Bunce@ig.co.uk, August 1994
 
 BEGIN {
-    $VERSION = '1.30';
+    $VERSION = '1.31';
 }
 
 use Config;
index bc9782c..576b08a 100644 (file)
@@ -371,6 +371,15 @@ CLONE(...)
     MY_CXT.x_dl_last_error = newSVpvs("");
     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;
+    dl_fab.fab$l_nam = &dl_nam;
+    dl_nam.nam$l_esa = dl_esa;
+    dl_nam.nam$b_ess = sizeof dl_esa;
+    dl_nam.nam$l_rsa = dl_rsa;
+    dl_nam.nam$b_rss = sizeof dl_rsa;
+
 #endif
 
 # end.