run dtors before taking the exit-lock in pthread exit

previously a long-running dtor could cause pthread_detach to block.
1 file changed