summaryrefslogtreecommitdiff
path: root/pod/perlpragma.pod
diff options
context:
space:
mode:
authorNicholas Clark <nick@ccl4.org>2007-02-12 10:52:28 +0000
committerNicholas Clark <nick@ccl4.org>2007-02-12 10:52:28 +0000
commit83a47afdc22cbd1f73f2816d864aef3c6bf23712 (patch)
treed273a9e6bbe6b01cdf14dc3e2b68bfa30fb4e2ef /pod/perlpragma.pod
parent6fcf14956bf66ed1321d73bace823568885030ac (diff)
downloadperl-83a47afdc22cbd1f73f2816d864aef3c6bf23712.tar.gz
Note why storing a reference as an integer in %^H is not threadsafe.
p4raw-id: //depot/perl@30221
Diffstat (limited to 'pod/perlpragma.pod')
-rw-r--r--pod/perlpragma.pod7
1 files changed, 7 insertions, 0 deletions
diff --git a/pod/perlpragma.pod b/pod/perlpragma.pod
index 12e8124d0c..51292a8a12 100644
--- a/pod/perlpragma.pod
+++ b/pod/perlpragma.pod
@@ -138,3 +138,10 @@ or complex structures, you should serialise them, for example with C<pack>.
The deletion of a hash key from C<%^H> is recorded, and as ever can be
distinguished from the existence of a key with value C<undef> with
C<exists>.
+
+B<Don't> attempt to store references to data structures as integers which
+are retrieved via C<caller> and converted back, as this will not be threadsafe.
+Accesses would be to the structure without locking (which is not safe for
+Perl's scalars), and either the structure has to leak, or it has to be
+freed when its creating thread terminates, which may be before the optree
+referencing it is deleted, if other threads outlive it.