Skip Menu |

This queue is for tickets about the Scalar-Defer CPAN distribution.

Report information
The Basics
Id: 54609
Status: open
Priority: 0/
Queue: Scalar-Defer

People
Owner: Nobody in particular
Requestors: sprout [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)



Subject: Scalar::Defer is not thread-safe
Date: Sun, 14 Feb 2010 14:37:48 -0800
To: bug-Scalar-Defer [...] rt.cpan.org
From: Father Chrysostomos <sprout [...] cpan.org>
If Scalar::Defer is loaded after a thread is created, no more threads can be started. The attached patch fixes this.

Message body is not shown because sender requested not to inline it.

Subject: Re: [rt.cpan.org #54609] Scalar::Defer is not thread-safe
Date: Wed, 17 Feb 2010 07:04:46 -0800
To: Father Chrysostomos via RT <bug-Scalar-Defer [...] rt.cpan.org>
From: Jesse Vincent <jesse [...] fsck.com>
Thanks! Applied as fef32b6 On Sun 14.Feb'10 at 17:38:57 -0500, Father Chrysostomos via RT wrote: Show quoted text
> Sun Feb 14 17:38:56 2010: Request 54609 was acted upon. > Transaction: Ticket created by sprout@cpan.org > Queue: Scalar-Defer > Subject: Scalar::Defer is not thread-safe > Broken in: (no value) > Severity: (no value) > Owner: Nobody > Requestors: sprout@cpan.org > Status: new > Ticket <URL: https://rt.cpan.org/Ticket/Display.html?id=54609 > > > > If Scalar::Defer is loaded after a thread is created, no more threads > can be started. > > The attached patch fixes this. >
Show quoted text
> diff -Nurp Scalar-Defer-0.22-GonFHe/MANIFEST Scalar-Defer-0.22-GonFHe copy/MANIFEST > --- Scalar-Defer-0.22-GonFHe/MANIFEST 2010-01-19 09:14:48.000000000 -0800 > +++ Scalar-Defer-0.22-GonFHe copy/MANIFEST 2010-02-04 09:30:15.000000000 -0800 > @@ -26,3 +26,4 @@ SIGNATURE > t/01-basic.t > t/02-is.t > t/03-autoload.t > +t/04-threads.t > diff -Nurp Scalar-Defer-0.22-GonFHe/lib/Scalar/Defer.pm Scalar-Defer-0.22-GonFHe copy/lib/Scalar/Defer.pm > --- Scalar-Defer-0.22-GonFHe/lib/Scalar/Defer.pm 2010-01-29 20:31:03.000000000 -0800 > +++ Scalar-Defer-0.22-GonFHe copy/lib/Scalar/Defer.pm 2010-02-04 09:29:56.000000000 -0800 > @@ -101,7 +101,10 @@ BEGIN { > }; > > { > - foreach my $sym (grep { $_ ne 'DESTROY' and $_ ne 'DEMOLISH' and $_ ne 'BEGIN' and $_ ne 'END' and $_ ne 'AUTOLOAD' } keys %UNIVERSAL::) { > + foreach my $sym (grep { > + $_ ne 'DESTROY' and $_ ne 'DEMOLISH' and $_ ne 'BEGIN' > + and $_ ne 'END' and $_ ne 'AUTOLOAD' and $_ ne 'CLONE_SKIP' > + } keys %UNIVERSAL::) { > my $code = q[ > sub $sym { > if ( defined Scalar::Util::blessed($_[0]) ) { > @@ -109,6 +112,9 @@ BEGIN { > goto &{$_[0]->can("$sym")}; > } > else { > + # Protect against future ALLCAPS methods > + return if $_[0] eq Scalar::Defer'DEFER_PACKAGE; > + > return shift->SUPER::$sym(@_); > } > } > diff -Nurp Scalar-Defer-0.22-GonFHe/t/04-threads.t Scalar-Defer-0.22-GonFHe copy/t/04-threads.t > --- Scalar-Defer-0.22-GonFHe/t/04-threads.t 1969-12-31 16:00:00.000000000 -0800 > +++ Scalar-Defer-0.22-GonFHe copy/t/04-threads.t 2010-02-04 09:27:24.000000000 -0800 > @@ -0,0 +1,15 @@ > +use strict; > +use warnings; > +use Config; > +use Test::More; > + > +plan skip_all => 'this test requires threads' if !$Config{useithreads}; > + > +plan tests => 1; > + > +require threads; > +create threads sub{}=>->join; > +require Scalar'Defer; > +create threads sub{}=>->join; > + > +pass();