Well, a thread can't be joined unless it returns or reaches the end of it's code block. In my various thread examples posted, I use a $die shared variable to signal the thread to return, then it can be joined. If you can't use that in your thread code block, you can put a while() loop at the end of your main code, which checks the threads->list, until all are joined. See
Just can't get threads to work The latest threads version available on cpan, has the ability to summarily kill a thread, which you can use on pesky threads that are locked up.
If that fails, use detached threads, which don't need to be joined, and will exit when the parent exits.