-/* sharedsv.c
+/* shared.xs
*
- * Copyright (c) 2001, Larry Wall
+ * Copyright (c) 2001-2002, Larry Wall
*
* You may distribute under the terms of either the GNU General Public
* License or the Artistic License, as specified in the README file.
recursive_lock_acquire(aTHX_ &ssv->lock, __FILE__, __LINE__);
}
+/* handles calls from lock() builtin via PL_lockhook */
+
void
Perl_sharedsv_locksv(pTHX_ SV *sv)
{
- Perl_sharedsv_lock(aTHX_ Perl_sharedsv_find(aTHX_ sv));
+ shared_sv* shared;
+
+ if(SvROK(sv))
+ sv = SvRV(sv);
+ shared = Perl_sharedsv_find(aTHX_ sv);
+ if(!shared)
+ croak("lock can only be used on shared values");
+ Perl_sharedsv_lock(aTHX_ shared);
}
=head1 Shared SV Functions
PROTOTYPE: \[$@%]
CODE:
shared_sv *shared;
+ ref = SvRV(ref);
if(SvROK(ref))
ref = SvRV(ref);
if( (shared = Perl_sharedsv_find(aTHX_ ref)) ){
PROTOTYPE: \[$@%]
CODE:
shared_sv *shared;
+ ref = SvRV(ref);
if(SvROK(ref))
ref = SvRV(ref);
if( (shared = Perl_sharedsv_find(aTHX_ ref)) ){
share(SV *ref)
PROTOTYPE: \[$@%]
CODE:
+ ref = SvRV(ref);
if(SvROK(ref))
ref = SvRV(ref);
- Perl_sharedsv_share(aTHX, ref);
+ Perl_sharedsv_share(aTHX_ ref);
void
lock_enabled(SV *ref)
PROTOTYPE: \[$@%]
CODE:
shared_sv* shared;
+ ref = SvRV(ref);
if(SvROK(ref))
ref = SvRV(ref);
- shared = Perl_sharedsv_find(aTHX, ref);
+ shared = Perl_sharedsv_find(aTHX_ ref);
if(!shared)
croak("lock can only be used on shared values");
Perl_sharedsv_lock(aTHX_ shared);
CODE:
shared_sv* shared;
int locks;
+ ref = SvRV(ref);
if(SvROK(ref))
ref = SvRV(ref);
shared = Perl_sharedsv_find(aTHX_ ref);
PROTOTYPE: \[$@%]
CODE:
shared_sv* shared;
+ ref = SvRV(ref);
if(SvROK(ref))
ref = SvRV(ref);
shared = Perl_sharedsv_find(aTHX_ ref);
+ if (ckWARN(WARN_THREADS) && shared->lock.owner != aTHX)
+ Perl_warner(aTHX_ packWARN(WARN_THREADS),
+ "cond_signal() called on unlocked variable");
if(!shared)
croak("cond_signal can only be used on shared values");
COND_SIGNAL(&shared->user_cond);
PROTOTYPE: \[$@%]
CODE:
shared_sv* shared;
+ ref = SvRV(ref);
if(SvROK(ref))
ref = SvRV(ref);
shared = Perl_sharedsv_find(aTHX_ ref);
if(!shared)
croak("cond_broadcast can only be used on shared values");
+ if (ckWARN(WARN_THREADS) && shared->lock.owner != aTHX)
+ Perl_warner(aTHX_ packWARN(WARN_THREADS),
+ "cond_broadcast() called on unlocked variable");
COND_BROADCAST(&shared->user_cond);
#endif /* USE_ITHREADS */