in reply to Re: yet another thread question: is Symbol::gensym threadsafe?
in thread yet another thread question: is Symbol::gensym threadsafe?
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
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: yet another thread question: is Symbol::gensym threadsafe?
by BrowserUk (Patriarch) on Oct 24, 2007 at 15:36 UTC | |
by tye (Sage) on Oct 24, 2007 at 16:13 UTC | |
by BrowserUk (Patriarch) on Oct 24, 2007 at 16:32 UTC | |
by ikegami (Patriarch) on Oct 24, 2007 at 17:03 UTC |