On Tue, Dec 4, 2012 at 9:15 PM, David Mertens <dcmertens.p...@gmail.com>wrote:

> Thanks for the explanation. Can you think of any way (apart from hackery)
> that I could check that a detached thread with the given tid exists? I do
> not need to manipulate it, I just need to know if it exists. I might
> consider tracking the existing threads through a shared array, but then I
> would have to modify the content of that shared array in an END block,
> which seems to be discouraged <<SNIP>>
>

You could wrap every user-supplied entry point function in your own
enclosing, anonymous sub for bookkeeping.  This sub is the true entry point
passed to threads->create(), and it touches `our %Tids : shared` before and
after invoking the user-supplied sub.  Thread 0 is still a special case.

Liz's Thread::Exit has an example of this approach.

-Mike

Reply via email to