Deleted Added
full compact
kern_thr.c (151316) kern_thr.c (151692)
1/*-
2 * Copyright (c) 2003, Jeffrey Roberson <jeff@freebsd.org>
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 11 unchanged lines hidden (view full) ---

20 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
21 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
22 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
24 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25 */
26
27#include <sys/cdefs.h>
1/*-
2 * Copyright (c) 2003, Jeffrey Roberson <jeff@freebsd.org>
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 11 unchanged lines hidden (view full) ---

20 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
21 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
22 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
24 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25 */
26
27#include <sys/cdefs.h>
28__FBSDID("$FreeBSD: head/sys/kern/kern_thr.c 151316 2005-10-14 12:43:47Z davidxu $");
28__FBSDID("$FreeBSD: head/sys/kern/kern_thr.c 151692 2005-10-26 06:55:46Z davidxu $");
29
30#include <sys/param.h>
31#include <sys/kernel.h>
32#include <sys/lock.h>
33#include <sys/mutex.h>
34#include <sys/proc.h>
35#include <sys/resourcevar.h>
36#include <sys/sched.h>
37#include <sys/sysctl.h>
38#include <sys/smp.h>
39#include <sys/sysent.h>
40#include <sys/systm.h>
41#include <sys/sysproto.h>
42#include <sys/signalvar.h>
43#include <sys/ucontext.h>
44#include <sys/thr.h>
29
30#include <sys/param.h>
31#include <sys/kernel.h>
32#include <sys/lock.h>
33#include <sys/mutex.h>
34#include <sys/proc.h>
35#include <sys/resourcevar.h>
36#include <sys/sched.h>
37#include <sys/sysctl.h>
38#include <sys/smp.h>
39#include <sys/sysent.h>
40#include <sys/systm.h>
41#include <sys/sysproto.h>
42#include <sys/signalvar.h>
43#include <sys/ucontext.h>
44#include <sys/thr.h>
45#include <sys/umtx.h>
46#include <sys/limits.h>
45
46#include <machine/frame.h>
47
48extern int max_threads_per_proc;
49extern int max_groups_per_proc;
50
51SYSCTL_DECL(_kern_threads);
52static int thr_scope = 0;

--- 217 unchanged lines hidden (view full) ---

270thr_exit(struct thread *td, struct thr_exit_args *uap)
271 /* long *state */
272{
273 struct proc *p;
274
275 p = td->td_proc;
276
277 /* Signal userland that it can free the stack. */
47
48#include <machine/frame.h>
49
50extern int max_threads_per_proc;
51extern int max_groups_per_proc;
52
53SYSCTL_DECL(_kern_threads);
54static int thr_scope = 0;

--- 217 unchanged lines hidden (view full) ---

272thr_exit(struct thread *td, struct thr_exit_args *uap)
273 /* long *state */
274{
275 struct proc *p;
276
277 p = td->td_proc;
278
279 /* Signal userland that it can free the stack. */
278 if ((void *)uap->state != NULL)
280 if ((void *)uap->state != NULL) {
279 suword((void *)uap->state, 1);
281 suword((void *)uap->state, 1);
282 kern_umtx_wake(td, uap->state, INT_MAX);
283 }
280
281 PROC_LOCK(p);
282 sigqueue_flush(&td->td_sigqueue);
283 mtx_lock_spin(&sched_lock);
284
285 /*
286 * Shutting down last thread in the proc. This will actually
287 * call exit() in the trampoline when it returns.

--- 107 unchanged lines hidden ---
284
285 PROC_LOCK(p);
286 sigqueue_flush(&td->td_sigqueue);
287 mtx_lock_spin(&sched_lock);
288
289 /*
290 * Shutting down last thread in the proc. This will actually
291 * call exit() in the trampoline when it returns.

--- 107 unchanged lines hidden ---