Ok, I try:
use threads;
&foo;
sub foo {
my $thr = threads->new(\&bar);
$thr->detach;
}
sub bar {
sleep(3);
print "bar\n";
}
And I get:
A thread exited while 2 other threads were still running.
And no evidence of bar\n being printed. What is this create function
you have? Is that the same as new()?
Ray
-----Original Message-----
From: Arthur Bergman [mailto:[EMAIL PROTECTED]]
Sent: 24 July 2002 14:45
To: Ray Hilton
Cc: 'Elizabeth Mattijsen'; [EMAIL PROTECTED];
[EMAIL PROTECTED]
Subject: Re: what is the scope of detached threads?
On onsdag, juli 24, 2002, at 02:18 , Ray Hilton wrote:
>
> I mean when &foo returns, will it kill &bar. It seems the answer is
> yes.
>
>
sub foo {
threads->create(\&bar)->detach();
}
sub bar {
sleep 2;
}
that thread will sleep 2 seconds then stop running.
Arthur