#define PERL_IN_SHAREDSV_C
#include "perl.h"
-PerlInterpreter* sharedsv_space;
-
#ifdef USE_ITHREADS
+PerlInterpreter* sharedsv_space;
+perl_mutex sharedsv_space_mutex;
+
/*
Shared SV
Perl_sharedsv_init(pTHX)
{
sharedsv_space = PERL_GET_CONTEXT;
+ MUTEX_INIT(&sharedsv_space_mutex);
}
/*
void
Perl_sharedsv_thrcnt_inc(pTHX_ shared_sv* ssv)
{
- SHAREDSvLOCK(ssv);
+ SHAREDSvEDIT(ssv);
SvREFCNT_inc(ssv->sv);
- SHAREDSvUNLOCK(ssv);
+ SHAREDSvRELEASE(ssv);
}
/*
Perl_sharedsv_thrcnt_dec(pTHX_ shared_sv* ssv)
{
SV* sv;
- SHAREDSvLOCK(ssv);
SHAREDSvEDIT(ssv);
sv = SHAREDSvGET(ssv);
if (SvREFCNT(sv) == 1) {
switch (SvTYPE(sv)) {
case SVt_RV:
if (SvROK(sv))
- Perl_sharedsv_thrcnt_dec(aTHX_ (shared_sv *)SvIV(SvRV(sv)));
+ Perl_sharedsv_thrcnt_dec(aTHX_ INT2PTR(shared_sv *, SvIV(SvRV(sv))));
break;
case SVt_PVAV: {
SV **src_ary = AvARRAY((AV *)sv);
while (items-- > 0) {
if(SvTYPE(*src_ary))
- Perl_sharedsv_thrcnt_dec(aTHX_ (shared_sv *)SvIV(*src_ary++));
+ Perl_sharedsv_thrcnt_dec(aTHX_ INT2PTR(shared_sv *, SvIV(*src_ary++)));
}
break;
}
(void)hv_iterinit((HV *)sv);
while ((entry = hv_iternext((HV *)sv)))
Perl_sharedsv_thrcnt_dec(
- aTHX_ (shared_sv *)SvIV(hv_iterval((HV *)sv, entry))
+ aTHX_ INT2PTR(shared_sv *, SvIV(hv_iterval((HV *)sv, entry)))
);
break;
}
}
SvREFCNT_dec(sv);
SHAREDSvRELEASE(ssv);
- SHAREDSvUNLOCK(ssv);
}
-#endif
+#endif /* USE_ITHREADS */