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

Re: Passing an IO:Handle to a Thread

Thread Previous | Thread Next
Dave Mitchell
February 29, 2008 15:58
Re: Passing an IO:Handle to a Thread
Message ID:
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)


    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 Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About