in reply to threads::shared locking via C API

The function you need to call is Perl_sharedsv_locksv(pTHX_ SV *sv) found in threads::shared.xs.

But good luck in working out how to link to it.

Another mystery that has long defeated me is quite where the perl-level lock() function (keyword or operator) lives and how it gets translated into a call to the above.


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.

Replies are listed 'Best First'.
Re^2: threads::shared locking via C API
by Anonymous Monk on Aug 26, 2011 at 07:57 UTC

      Yes, thanks. But that doesn't get you very far.

      c:\test\perl-5.14.0-RC1>findstr SvLOCK *.? pp.c: SvLOCK(sv); sv.h:=for apidoc Am|void|SvLOCK|SV* sv sv.h:#define SvLOCK(sv) PL_lockhook(aTHX_ sv) c:\test\perl-5.14.0-RC1>findstr PL_lockhook *.? embedvar.h:#define PL_lockhook (vTHX->Ilockhook) embedvar.h:#define PL_Ilockhook PL_lockhook sv.c: PL_lockhook = proto_perl->Ilockhook; sv.h:#define SvLOCK(sv) PL_lockhook(aTHX_ sv) c:\test\perl-5.14.0-RC1>findstr Ilockhook *.? embedvar.h:#define PL_lockhook (vTHX->Ilockhook) embedvar.h:#define PL_Ilockhook PL_lockhook intrpvar.h:PERLVARI(Ilockhook, share_proc_t, Perl_sv_nosharing) sv.c: PL_lockhook = proto_perl->Ilockhook;

      The whole 'lock locks the variable if threading is enable but is a silent noop otherwise', is the single most pointless piece of logic ever. (After the over-elaborate feature mechanism that is.)


      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.