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

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

From:
Nick Ing-Simmons
Date:
November 16, 1999 09:52
Subject:
Re: [PATCH 5.005_62]Allow XS code to lock arbitrary scalars
Message ID:
199911161751.RAA29781@tiuk.ti.com
Dan Sugalski <dan@sidhe.org> 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 
extensions.

>+=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:

  ENTER;
  SvLOCK(sv)
  ...
  LEAVE;

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

-- 
Nick Ing-Simmons <nik@tiuk.ti.com>
Via, but not speaking for: Texas Instruments Ltd.




nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About