Since the root cause is now known, a workaround of the problem is now also easy to do. Which I've done in the form of a new module: Thread::Detach (also available from http://www.liz.nl/CPAN if it hasn't arrived on a CPAN mirror near you yet).
From the pod:
This module replaces the standard threads->detach method with another
subroutine that just sets an internal flag to mark the thread as "detached".
Futhermore it uses Thread::Exit to register a subroutine that is executed
after each thread is finished executing: this subroutine marks the thread as
"done".
Lastly, it uses Thread::Exit to register a subroutine that is executed
at the beginning of each thread: this subroutine reaps all the threads that
were marked "done", hence providing the necessary cleanup.
Unfortunately, I have not been able to really test the module, as I don't do Windows myself. So I appreciate any bug reports, should there be any (which will undoubtedly be the case).
This module should allow you to run all your threaded applications that used threads->detach unchanged by adding -MThread::Detach to the command line, or by setting the PERL5OPT environment variable.
Liz