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

Re^2: Use perl type without perl

by xiaoyafeng (Chaplain)
on Sep 25, 2012 at 13:26 UTC ( #995545=note: print w/ replies, xml ) Need Help??


in reply to Re: Use perl type without perl
in thread Use perl type without perl

If you use a non-threaded perl, you probably will never need my_perl.

Could you please elaborate it? I'm curious why non-threaded perl can do what thread perl can't do. Thanks




I am trying to improve my English skills, if you see a mistake please feel free to reply or /msg me a correction


Comment on Re^2: Use perl type without perl
Re^3: Use perl type without perl
by BrowserUk (Pope) on Sep 25, 2012 at 13:39 UTC

    In a single-threaded perl, there is only one copy of stuff like current working directory, environment etc.

    In a multi-threaded perl, each thread needs its own copy of that information.

    So, for the single-threaded perl, the PERL_CONTEXT can be known at compile time and linked statically into code. A single static pointer to a struct that contains all the per-thread information is all that is required, because there is only one thread.

    In a multi-threaded perl, each function that needs access to the "current PERL_CONTEXT" need to be able to find the appropriate context for the thread it is running in; hence it needs the my_perl variable which tells it which context that is.


    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.

    RIP Neil Armstrong

    div class=
      Just because in single threaded perl there is no my_perl doesn't mean you can use the types without initializing/having a perl interp set up. SV *s aren't straight malloced from the C lib but come out of a pool the interp maintains.

        Did I say that you could?


        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.

        RIP Neil Armstrong

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others having an uproarious good time at the Monastery: (9)
As of 2014-09-22 21:49 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    How do you remember the number of days in each month?











    Results (204 votes), past polls