develooper Front page | perl.perl5.porters | Postings from November 1999

Re: [PATCH 5.005_62]Allow XS code to lock arbitrary scalars

Nick Ing-Simmons
November 16, 1999 09:52
Re: [PATCH 5.005_62]Allow XS code to lock arbitrary scalars
Message ID:
Dan Sugalski <> writes:
>The following patch provides a new macro, SvLOCK, which lets XS code snag a
>perl-level lock on an arbitrary SV *.

Thanks for this - it will be vital to thread-safing Tk and other heavy XS 

>+=item SvLOCK
>+Take out a perl lock on the SV. (Note that this is B<not> the same as
>+aquiring a mutex on the SV *) Equivalent to doing a C<lock $foo;>
>+from perl.
>+        void SvLOCK(SV* sv)

I assume that normal use is something like:


i.e. that it unlocks on scope exit like C<local $foo>.
If so suggest you document it that way.

Nick Ing-Simmons <>
Via, but not speaking for: Texas Instruments Ltd. Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About