Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
PerlMonks  

Re: How do I get a unique Perl Interpreter ID?

by BrowserUk (Pope)
on Dec 01, 2011 at 03:38 UTC ( #940998=note: print w/ replies, xml ) Need Help??


in reply to How do I get a unique Perl Interpreter ID?

prefer to stay in pure Perl if I possibly can.

AFAIK, outside of going into XS to create your own interpreter; thread == interpreter.

So, if you're staying in pure Perl -- and therefore not creating any Interpreters yourself explicitly; or implicitly other than via threads (& Windows fork emulation) -- then the combination of pid & tid should be unique.

Other than the possibility where the 32-bit tid wraps around, but if you're creating that many threads in a single process, then you could probably use the week number or maybe even month instead of the pid :)


With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.

The start of some sanity?

  • Comment on Re: How do I get a unique Perl Interpreter ID?

Replies are listed 'Best First'.
Re^2: How do I get a unique Perl Interpreter ID?
by zwon (Monsignor) on Dec 01, 2011 at 07:11 UTC
    As OP mentioned mod_perl under worker MPM I doubt that tid will work. Mod_perl creates its interpreters using perl_clone, without help of threads. Can't test at the moment though.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://940998]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others scrutinizing the Monastery: (9)
As of 2016-07-29 19:38 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    What is your favorite alternate name for a (specific) keyboard key?


















    Results (264 votes). Check out past polls.