pthread_atfork should acquire writer lock and protect the code

with critical region.
This commit is contained in:
David Xu 2010-09-01 03:55:10 +00:00
parent ada33a6e36
commit a523216bc6
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=212078

View File

@ -89,9 +89,11 @@ _pthread_atfork(void (*prepare)(void), void (*parent)(void),
af->prepare = prepare;
af->parent = parent;
af->child = child;
_thr_rwl_rdlock(&_thr_atfork_lock);
THR_CRITICAL_ENTER(curthread);
_thr_rwl_wrlock(&_thr_atfork_lock);
TAILQ_INSERT_TAIL(&_thr_atfork_list, af, qe);
_thr_rwl_unlock(&_thr_atfork_lock);
THR_CRITICAL_LEAVE(curthread);
return (0);
}