diff options
author | Jerry D. Hedden <jdhedden@cpan.org> | 2007-09-05 05:50:24 -0400 |
---|---|---|
committer | Rafael Garcia-Suarez <rgarciasuarez@gmail.com> | 2007-09-05 13:53:16 +0000 |
commit | 7c8caac01fed14372509c397e3e7b8ddc0ce3513 (patch) | |
tree | 63c9d993a7714d5da142008bc751848560c47c1e /ext/threads/shared | |
parent | 01112dae7d0bba7f093e86dca1adee26f9da1b1c (diff) | |
download | perl-7c8caac01fed14372509c397e3e7b8ddc0ce3513.tar.gz |
threads::shared 1.13
From: "Jerry D. Hedden" <jdhedden@cpan.org>
Message-ID: <1ff86f510709050650j3c3f54b2o64c8ce05dc4c8604@mail.gmail.com>
p4raw-id: //depot/perl@31795
Diffstat (limited to 'ext/threads/shared')
-rw-r--r-- | ext/threads/shared/shared.pm | 12 | ||||
-rw-r--r-- | ext/threads/shared/shared.xs | 5 | ||||
-rw-r--r-- | ext/threads/shared/t/0nothread.t | 2 | ||||
-rw-r--r-- | ext/threads/shared/t/blessed.t | 44 | ||||
-rw-r--r-- | ext/threads/shared/t/waithires.t | 2 |
5 files changed, 34 insertions, 31 deletions
diff --git a/ext/threads/shared/shared.pm b/ext/threads/shared/shared.pm index fe8cf6e5d2..06829a1409 100644 --- a/ext/threads/shared/shared.pm +++ b/ext/threads/shared/shared.pm @@ -5,7 +5,7 @@ use 5.008; use strict; use warnings; -our $VERSION = '1.12'; +our $VERSION = '1.13'; my $XS_VERSION = $VERSION; $VERSION = eval $VERSION; @@ -73,7 +73,7 @@ threads::shared - Perl extension for sharing data structures between threads =head1 VERSION -This document describes threads::shared version 1.12 +This document describes threads::shared version 1.13 =head1 SYNOPSIS @@ -108,7 +108,7 @@ This document describes threads::shared version 1.12 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 @@ -205,11 +205,11 @@ the variable, and blocks until another thread does a C<cond_signal> or 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 @@ -368,7 +368,7 @@ L<threads::shared> Discussion Forum on CPAN: 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/> diff --git a/ext/threads/shared/shared.xs b/ext/threads/shared/shared.xs index b8c057a0a2..4115bf1146 100644 --- a/ext/threads/shared/shared.xs +++ b/ext/threads/shared/shared.xs @@ -1328,7 +1328,10 @@ _refcnt(SV *ref) 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))); diff --git a/ext/threads/shared/t/0nothread.t b/ext/threads/shared/t/0nothread.t index 0e5216e1cc..0808277787 100644 --- a/ext/threads/shared/t/0nothread.t +++ b/ext/threads/shared/t/0nothread.t @@ -77,7 +77,7 @@ if ($threads::shared::VERSION && ! exists($ENV{'PERL_CORE'})) { array(24, [], 'Thing'); hash(24, [], 'Thing'); -import threads::shared; +threads::shared->import(); share(\@array); array(24, 42, 'Thing'); diff --git a/ext/threads/shared/t/blessed.t b/ext/threads/shared/t/blessed.t index 4408c36ce2..91a2ac34d5 100644 --- a/ext/threads/shared/t/blessed.t +++ b/ext/threads/shared/t/blessed.t @@ -99,28 +99,28 @@ ok(23, ref($$hobj{'array'}) eq 'yang', "blessed array in hash"); 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"); diff --git a/ext/threads/shared/t/waithires.t b/ext/threads/shared/t/waithires.t index 7c5ee7c7c1..22e9c73563 100644 --- a/ext/threads/shared/t/waithires.t +++ b/ext/threads/shared/t/waithires.t @@ -13,7 +13,7 @@ BEGIN { } eval { require Time::HiRes; - import Time::HiRes qw(time); + Time::HiRes->import('time'); }; if ($@) { print("1..0 # Skip: Time::HiRes not available.\n"); |