summaryrefslogtreecommitdiffstats
path: root/lib/libthr/thread/thr_fork.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/libthr/thread/thr_fork.c')
-rw-r--r--lib/libthr/thread/thr_fork.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/lib/libthr/thread/thr_fork.c b/lib/libthr/thread/thr_fork.c
index 1ce7c6e..c70096e 100644
--- a/lib/libthr/thread/thr_fork.c
+++ b/lib/libthr/thread/thr_fork.c
@@ -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);
}
OpenPOWER on IntegriCloud