New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
current :unique implementation *not* threadsafe #7985
Comments
From @nwc10Created by @nwc10The current implementation of :unique is most definitely not threadsafe. Setting SvREADONY() on a perl scalar *does not* stop the core modifying that 1: still take a reference to a :unique object, which means modifying its 2: still stringify a :unique object. (And for that matter promote its type, 3: modify the elements of an array marked readonly Modifying the existing gv_share code to recurse over anything it points to Patches welcome for a better, correct, implementation. I think something Nicholas Clark 1: #!perl -w use threads; package Foo; our $bar = "Bug"; package main; my $count = shift || 1000; foreach (0..15) { $_->join foreach @threads; 2: #!perl -w use threads; package Foo; our $bar : unique = -1.3e-5; package main; my $count = shift || 16; use Devel::Peek; foreach (1..$count) { $_->join foreach @threads; Dump $Foo::bar; 3: #!perl -w use threads; package Foo; our @bar : unique = "aaa"; package main; my $count = shift || 1000; foreach (0..15) { $_->join foreach @threads; print "$Foo::bar[0]\n"; Perl Info
|
From @lizmatAt 4:33 PM +0000 6/23/05, Nicholas Clark (via RT) wrote:
FWIW: I think this nails the coffin on :unique. I think the safest would be to deprecate ":unique" by making it a With the current state of parrot / pugs / perl 6 / ponie I don't Just my 1.5 eurocents. Liz |
The RT System itself - Status changed from 'new' to 'open' |
From @rgarciaOn 6/23/05, Elizabeth Mattijsen <liz@dijkmat.nl> wrote:
Strictly speaking, deprecation and removal are not the same thing. I don't think there's much advanced threaded perl code out there, but
Except if it helps ponie. |
From @lizmatAt 10:54 PM +0200 6/23/05, Rafael Garcia-Suarez wrote:
You're right: I meant ":unique" to become a noop in blead (and 5.10
I think I've introduced a few ":unique"'s in the Perl core modules in
That was something I hadn't considered. Would it? Liz |
From @nwc10On Thu, Jun 23, 2005 at 11:24:10PM +0200, Elizabeth Mattijsen wrote:
I see no actual harm in making it a no-op everywhere. (For now, pending
That can't go into maint. However, I think I can see a reasonable efficient way of making unique If a (unique) scalar in one thread is a reference back to a copy in a parent
I confess that taking out the current implementation would, because it Nicholas Clark |
From @rgarciaOn 6/23/05, Nicholas Clark <nick@ccl4.org> wrote:
Your call :)
I can't detect any :unique in blead modules.
So that's a big plus for removing it (which is already done in fact). |
From @nwc10On Thu, Jun 23, 2005 at 11:49:14PM +0200, Rafael Garcia-Suarez wrote:
The only one I know of is our $summary : unique in Config_heavy.pl
I actually like the idea of :unique. It's just finding a viable way to Then again, if copy on write can be made to work across threads, I guess it Nicholas Clark |
From @lizmatAt 10:58 PM +0100 6/23/05, Nicholas Clark wrote:
Indeed. And you won't have to break your mind anymore where to add Liz |
From @rgsNicholas Clark wrote:
Removed as change #25195 in blead.
OK. But until it's rewritten, I think we should turn it into a no-op that |
From @lizmatAt 1:10 PM +0200 7/20/05, Rafael Garcia-Suarez wrote:
Agree. Liz |
@cpansprout - Status changed from 'open' to 'resolved' |
Migrated from rt.perl.org#36375 (status was 'resolved')
Searchable as RT36375$
The text was updated successfully, but these errors were encountered: