use strict;
use warnings;
-our $VERSION = '1.12';
+our $VERSION = '1.13';
my $XS_VERSION = $VERSION;
$VERSION = eval $VERSION;
=head1 VERSION
-This document describes threads::shared version 1.12
+This document describes threads::shared version 1.13
=head1 SYNOPSIS
By default, variables are private to each thread, and each newly created
thread gets a private copy of each existing variable. This module allows you
-to share variables across different threads (and pseudoforks on Win32). It is
+to share variables across different threads (and pseudo-forks on Win32). It is
used together with the L<threads> module.
=head1 EXPORT
C<cond_broadcast> for that same locked variable. The variable that
C<cond_wait> blocked on is relocked after the C<cond_wait> is satisfied. If
there are multiple threads C<cond_wait>ing on the same variable, all but one
-will reblock waiting to reacquire the lock on the variable. (So if you're only
+will re-block waiting to reacquire the lock on the variable. (So if you're only
using C<cond_wait> for synchronisation, give up the lock as soon as possible).
The two actions of unlocking the variable and entering the blocked wait state
are atomic, the two actions of exiting from the blocked wait state and
-relocking the variable are not.
+re-locking the variable are not.
In its second form, C<cond_wait> takes a shared, B<unlocked> variable followed
by a shared, B<locked> variable. The second variable is unlocked and thread
L<http://www.cpanforum.com/dist/threads-shared>
Annotated POD for L<threads::shared>:
-L<http://annocpan.org/~JDHEDDEN/threads-shared-1.12/shared.pm>
+L<http://annocpan.org/~JDHEDDEN/threads-shared-1.13/shared.pm>
Source repository:
L<http://code.google.com/p/threads-shared/>
ref = SvRV(ref);
ssv = Perl_sharedsv_find(aTHX_ ref);
if (! ssv) {
- Perl_warn(aTHX_ "%" SVf " is not shared", ST(0));
+ if (ckWARN(WARN_THREADS)) {
+ Perl_warner(aTHX_ packWARN(WARN_THREADS),
+ "%" SVf " is not shared", ST(0));
+ }
XSRETURN_UNDEF;
}
ST(0) = sv_2mortal(newSViv(SvREFCNT(ssv)));
ok(24, ref($$hobj{'scalar'}) eq 'baz', "blessed scalar in hash");
ok(25, ${$$hobj{'scalar'}} eq '3', "blessed scalar in hash contents");
-threads->new(sub {
- # Rebless objects
- bless $hobj, 'oof';
- bless $aobj, 'rab';
- bless $sobj, 'zab';
-
- my $data = $$aobj[0];
- bless $data, 'niy';
- $$aobj[0] = $data;
- $data = $$aobj[1];
- bless $data, 'gnay';
- $$aobj[1] = $data;
-
- $data = $$hobj{'hash'};
- bless $data, 'niy';
- $$hobj{'hash'} = $data;
- $data = $$hobj{'array'};
- bless $data, 'gnay';
- $$hobj{'array'} = $data;
-
- $$sobj = 'test';
- })->join;
+threads->create(sub {
+ # Rebless objects
+ bless $hobj, 'oof';
+ bless $aobj, 'rab';
+ bless $sobj, 'zab';
+
+ my $data = $$aobj[0];
+ bless $data, 'niy';
+ $$aobj[0] = $data;
+ $data = $$aobj[1];
+ bless $data, 'gnay';
+ $$aobj[1] = $data;
+
+ $data = $$hobj{'hash'};
+ bless $data, 'niy';
+ $$hobj{'hash'} = $data;
+ $data = $$hobj{'array'};
+ bless $data, 'gnay';
+ $$hobj{'array'} = $data;
+
+ $$sobj = 'test';
+ })->join();
# Test reblessing
ok(26, ref($hobj) eq 'oof', "hash reblessing does work");