in reply to "Attempt to free unreferenced scalar" and "Scalars leaked: 1" ?

This is my first attempt at threads. I did a variation on your A.pl. I have perlv5.8.8, threaded and shared:

#!/usr/bin/perl use strict; use warnings; use threads; use threads::shared; my $dummy : shared = 1; threads->new(sub { "B::c", $dummy++ })->join; print "$dummy\n";
  • Comment on Re: "Attempt to free unreferenced scalar" and "Scalars leaked: 1" ?
  • Download Code

Replies are listed 'Best First'.
Re^2: "Attempt to free unreferenced scalar" and "Scalars leaked: 1" ?
by licht (Novice) on Mar 31, 2007 at 23:30 UTC

    I don't know if I understand right, but the code seems to me the thread is based on code that resides in the same file as caller AND this thread will execute subroutine "c" in module B?

    threads->new(sub { "B::c", $dummy++ })->join;

    I really want to run a thread based on codes in different files other than the caller.