Hmmm, maybe:

$thr->detach_nb();

or something.  In my mind, if a process is detached, and in a global
scope, it should be waited for.  That makes sense as otherwise you have
no method of making sure the process is finished by the time the main
app finishes.  This was something originally spec'd out in 5005 that
perl will handle the detached thread, and clean it up for you.

Ray

-----Original Message-----
From: Arthur Bergman [mailto:[EMAIL PROTECTED]] 
Sent: 24 July 2002 11:47
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 12:42 , Ray Hilton 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?  Or will it last
till
> the end of the process?  Either way, it seems perl will not hang
around
> for detached threads to finish off, unlike 5005 threads, not sure if
> this is a curse or a blessing yet :)
>
>

Yes, as soon as bar() exits the thread will be gone.

And no, perl does not hang around for detached threads to finish off, I 
think that it should be I was outvoted, that is life :).

However I am going to to update threads.xs with an option to wait, but I

need some ideas on the interface, or even better, patches :-)

Arthur


Reply via email to