diff options
Diffstat (limited to 'lib/libpthread/uthread/uthread_vfork.c')
-rw-r--r-- | lib/libpthread/uthread/uthread_vfork.c | 21 |
1 files changed, 19 insertions, 2 deletions
diff --git a/lib/libpthread/uthread/uthread_vfork.c b/lib/libpthread/uthread/uthread_vfork.c index 10f8586536a..545bcdc96ba 100644 --- a/lib/libpthread/uthread/uthread_vfork.c +++ b/lib/libpthread/uthread/uthread_vfork.c @@ -1,12 +1,29 @@ -/* $OpenBSD: uthread_vfork.c,v 1.3 2007/11/20 19:35:37 deraadt Exp $ */ +/* $OpenBSD: uthread_vfork.c,v 1.4 2008/04/04 19:30:41 kurt Exp $ */ #include <unistd.h> #ifdef _THREAD_SAFE +#include <pthread.h> +#include "pthread_private.h" pid_t _dofork(int vfork); pid_t vfork(void) { - return (_dofork(1)); + pid_t pid; + + /* + * Defer signals to protect the scheduling queues from access + * by the signal handler: + */ + _thread_kern_sig_defer(); + + pid = _dofork(1); + + /* + * Undefer and handle pending signals, yielding if necessary: + */ + _thread_kern_sig_undefer(); + + return (pid); } #endif |