run dtors before taking the exit-lock in pthread exit

previously a long-running dtor could cause pthread_detach to block.
diff --git a/src/thread/pthread_create.c b/src/thread/pthread_create.c
index d1eea0c..c856c58 100644
--- a/src/thread/pthread_create.c
+++ b/src/thread/pthread_create.c
@@ -22,10 +22,10 @@
 		longjmp((void *)cb->__next->__jb, 1);
 	}
 
-	__lock(&self->exitlock);
-
 	__pthread_tsd_run_dtors();
 
+	__lock(&self->exitlock);
+
 	/* Mark this thread dead before decrementing count */
 	self->dead = 1;