From: Nicholas Clark Date: Mon, 12 Feb 2007 10:52:28 +0000 (+0000) Subject: Note why storing a reference as an integer in %^H is not threadsafe. X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=83a47afdc22cbd1f73f2816d864aef3c6bf23712;p=p5sagit%2Fp5-mst-13.2.git Note why storing a reference as an integer in %^H is not threadsafe. p4raw-id: //depot/perl@30221 --- diff --git a/pod/perlpragma.pod b/pod/perlpragma.pod index 12e8124..51292a8 100644 --- a/pod/perlpragma.pod +++ b/pod/perlpragma.pod @@ -138,3 +138,10 @@ or complex structures, you should serialise them, for example with C. 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 with C. + +B attempt to store references to data structures as integers which +are retrieved via C 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.