return the address of an anonymous glob
I'd be vaguely uncomfortable with the idea that memory could be recycled and at some point you would generate the symbol name more than once.
I would be inclined to extend the symbol name to include the current thread id:
use Config (); sub gensym () { my $id = $Config{useithreads} ? threads->tid . '-' : ''; my $name = "GEN$t" . $genseq++; my $ref = \*{$genpkg . $name}; delete $$genpkg{$name}; $ref; }
• another intruder with the mooring in the heart of the Perl
In reply to Re^2: yet another thread question: is Symbol::gensym threadsafe?
by grinder
in thread yet another thread question: is Symbol::gensym threadsafe?
by TOD
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |