I mean when &foo returns, will it kill &bar. It seems the answer is yes.
-----Original Message----- From: Elizabeth Mattijsen [mailto:[EMAIL PROTECTED]] Sent: 24 July 2002 13:05 To: Arthur Bergman; Ray Hilton Cc: [EMAIL PROTECTED]; [EMAIL PROTECTED] Subject: Re: what is the scope of detached threads? At 12:47 PM 7/24/02 +0200, Arthur Bergman wrote: >>Is it correct that detached threads will only last for the duration of >>the scope of their object, such that: >> >>sub foo { >> my $thr = threads->new(&bar); >> $thr->detach; >>} >>will terminate the thread on exiting the function? Do you mean exiting "foo" or exiting "bar"? From the rest of the mail I got the impression you're thinking that the thread will exit when "foo" is exited. That is not true. The thread will stop running (not exit!) as soon as "bar" is done. An exit() in any thread will exit the entire process, taking all other threads with it. Hope I fixed a potential misconception here.... Liz
