diff options
| author | 2004-12-08 06:56:14 +0000 | |
|---|---|---|
| committer | 2004-12-08 06:56:14 +0000 | |
| commit | f229b07cf594bbfb6208fe2139a2074b9337ad20 (patch) | |
| tree | 1e65fd94ccd9456a52873f8cf5bb906eedb18fa8 | |
| parent | avoid resending a directory if it was the last directory sent to the (diff) | |
| download | wireguard-openbsd-f229b07cf594bbfb6208fe2139a2074b9337ad20.tar.xz wireguard-openbsd-f229b07cf594bbfb6208fe2139a2074b9337ad20.zip | |
Have kthread_create_deferred() act immediately once kthread_run_deferred_queue()
has been invoked; forgotten part of the ``create init earlier'' changes.
From NetBSD as well.
ok deraadt@ dlg@
| -rw-r--r-- | sys/kern/kern_kthread.c | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/sys/kern/kern_kthread.c b/sys/kern/kern_kthread.c index 721c440c999..971d5e76eb6 100644 --- a/sys/kern/kern_kthread.c +++ b/sys/kern/kern_kthread.c @@ -1,8 +1,8 @@ -/* $OpenBSD: kern_kthread.c,v 1.23 2004/11/23 19:08:55 miod Exp $ */ +/* $OpenBSD: kern_kthread.c,v 1.24 2004/12/08 06:56:14 miod Exp $ */ /* $NetBSD: kern_kthread.c,v 1.3 1998/12/22 21:21:36 kleink Exp $ */ /*- - * Copyright (c) 1998 The NetBSD Foundation, Inc. + * Copyright (c) 1998, 1999 The NetBSD Foundation, Inc. * All rights reserved. * * This code is derived from software contributed to The NetBSD Foundation @@ -56,6 +56,8 @@ */ #include <sys/stdarg.h> +int kthread_create_now; + /* * Fork a kernel thread. Any process can request this to be done. * The VM space and limits, etc. will be shared with proc0. @@ -139,6 +141,11 @@ kthread_create_deferred(void (*func)(void *), void *arg) { struct kthread_q *kq; + if (kthread_create_now) { + (*func)(arg); + return; + } + kq = malloc(sizeof *kq, M_TEMP, M_NOWAIT); if (kq == NULL) panic("unable to allocate kthread_q"); @@ -155,6 +162,9 @@ kthread_run_deferred_queue(void) { struct kthread_q *kq; + /* No longer need to defer kthread creation. */ + kthread_create_now = 1; + while ((kq = SIMPLEQ_FIRST(&kthread_q)) != NULL) { SIMPLEQ_REMOVE_HEAD(&kthread_q, kq_q); (*kq->kq_func)(kq->kq_arg); |
