瀏覽代碼

run dtors before taking the exit-lock in pthread exit

previously a long-running dtor could cause pthread_detach to block.
Rich Felker 14 年之前
父節點
當前提交
f58c8a0f39
共有 1 個文件被更改,包括 2 次插入2 次删除
  1. 2 2
      src/thread/pthread_create.c

+ 2 - 2
src/thread/pthread_create.c

@@ -22,10 +22,10 @@ void __pthread_unwind_next(struct __ptcb *cb)
 		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;