Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: Perl: porters
Re: [perl #100840] DESTROY called twice on objects created in threads
 

Index | Next | Previous | View Flat


ikegami at adaelis

Oct 6, 2011, 1:55 PM


Views: 153
Permalink
Re: [perl #100840] DESTROY called twice on objects created in threads [In reply to]

sub func {
my $obj = Foo->new();
}

is functionally the same as

sub func {
return my $obj = Foo->new();
}

which is effectively the same as

sub func {
return Foo->new();
}

In order for join() to return this value, it needs to be cloned. $obj gets
cloned, the original gets destroyed, and the clone is returned by join()
where it is destroyed. Fix:

sub func {
my $obj = Foo->new();
1;
}

This isn't a bug.

Subject User Time
[perl #100840] DESTROY called twice on objects created in threads perlbug-followup at perl Oct 6, 2011, 8:01 AM
    Re: [perl #100840] DESTROY called twice on objects created in threads ikegami at adaelis Oct 6, 2011, 1:55 PM

  Index | Next | Previous | View Flat
 
 


Interested in having your list archived? Contact Gossamer Threads
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.