The following patch provides a new macro, SvLOCK, which lets XS code snag a perl-level lock on an arbitrary SV *. (FWIW, I can't get inbound mail for a while, so replies'll be a bit tardy) --- sv.h;1 Sat Sep 25 06:25:28 1999 +++ sv.h Mon Nov 15 12:27:56 1999 @@ -696,3 +696,19 @@ #define SvGROW(sv,len) (SvLEN(sv) < (len) ? sv_grow(sv,len) : SvPVX(sv)) #define Sv_Grow sv_grow + +#ifdef USE_THREADS +# define SvLOCK(sv) STMT_START { \ + dSP; \ + SAVETMPS; \ + PUSHMARK(SP); \ + XPUSHs(sv); \ + PUTBACK; \ + Perl_pp_lock(ARGS); \ + SPAGAIN; \ + PUTBACK; \ + FREETMPS; \ + } STMT_END +#else +# define SvLOCK(sv) +#endif --- pod/perlguts.pod;1 Sun Oct 10 19:37:53 1999 +++ pod/perlguts.pod Tue Nov 16 09:25:48 1999 @@ -3159,6 +3159,14 @@ STRLEN sv_len (SV* sv) +=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) + =item sv_magic Adds magic to an SV. ## End of Patch ## Dan ----------------------------------------"it's like this"------------------- Dan Sugalski even samurai dan@sidhe.org have teddy bears and even teddy bears get drunk