threads::shared 1.13
Jerry D. Hedden [Wed, 5 Sep 2007 09:50:24 +0000 (05:50 -0400)]
From: "Jerry D. Hedden" <jdhedden@cpan.org>
Message-ID: <1ff86f510709050650j3c3f54b2o64c8ce05dc4c8604@mail.gmail.com>

p4raw-id: //depot/perl@31795

ext/threads/shared/shared.pm
ext/threads/shared/shared.xs
ext/threads/shared/t/0nothread.t
ext/threads/shared/t/blessed.t
ext/threads/shared/t/waithires.t

index fe8cf6e..06829a1 100644 (file)
@@ -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/>
index b8c057a..4115bf1 100644 (file)
@@ -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)));
index 0e5216e..0808277 100644 (file)
@@ -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');
index 4408c36..91a2ac3 100644 (file)
@@ -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");
index 7c5ee7c..22e9c73 100644 (file)
@@ -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");