pthread_atfork should acquire writer lock and protect the code
with critical region.
This commit is contained in:
parent
ada33a6e36
commit
a523216bc6
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=212078
@ -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);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user