develooper Front page | perl.ithreads | Postings from February 2008

Re: Passing an IO:Handle to a Thread

Thread Previous | Thread Next
From:
Dave Mitchell
Date:
February 29, 2008 15:58
Subject:
Re: Passing an IO:Handle to a Thread
Message ID:
20080229235813.GI3747@iabyn.com
On Wed, Feb 27, 2008 at 08:15:36AM -0800, Dean Arnold wrote:
> As to shared object destruction:
> 
> pre-5.10.0: once per thread, requires some extra bookkeeping to make sure
> it "does the right thing"
> 
> 5.10.0: once in the last referencing thread (fixed in CORE)

Huh?

    use warnings;
    use strict;

    use threads;
    use threads::shared;

    sub DESTROY { warn "DESTROY $_[0]\n" }

    my $h = bless {};
    share $h;
    threads->new(sub {})->join;

$ perl5100t /tmp/p
DESTROY main=HASH(0x98fb844)
DESTROY main=HASH(0x98748c4)
$ 


-- 
I before E. Except when it isn't.

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About