perl-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Torsten Foertsch <torsten.foert...@gmx.net>
Subject What is PERL_SET_CONTEXT for?
Date Wed, 26 Sep 2007 17:08:23 GMT
Hi,

in modperl_callback.c I have found this piece of code:

    if (r || c) {
        interp = modperl_interp_select(r, c, s);
        aTHX = interp->perl;
    }
    else {
        /* Child{Init,Exit}, OpenLogs */
        aTHX = scfg->mip->parent->perl;
        PERL_SET_CONTEXT(aTHX);
    }

"man perlembed" says:

       Note the calls to PERL_SET_CONTEXT().  These are necessary to initialā€
       ize the global state that tracks which interpreter is the "current" one
       on the particular process or thread that may be running it.  It should
       always be used if you have more than one interpreter and are making
       perl API calls on both interpreters in an interleaved fashion.

       PERL_SET_CONTEXT(interp) should also be called whenever "interp" is
       used by a thread that did not create it (using either perl_alloc(), or
       the more esoteric perl_clone()).

So, is it an error not to call PERL_SET_CONTEXT in the if-branch?

Shouldn't PERL_SET_CONTEXT be called every time an interpreter is selected?

Thanks,
Torsten

Mime
View raw message